Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-22-2005, 07:02 PM   #1
fireorange
Confirmed User
 
Join Date: Jan 2005
Posts: 1,648
MySQL db problems

I'm trying to create two foreign keys so that when I delete Gallery_ID 23 in the 'Galleries' table, it automatically deletes it in the 'Clicks' table but it isn't working.

Code:
CREATE TABLE `Galleries` (
`Gallery_ID` INT NOT NULL AUTO_INCREMENT ,
`Gallery_URL` VARCHAR( 255 ) NOT NULL ,
`Category` VARCHAR( 50 ) NOT NULL ,
PRIMARY KEY ( `Gallery_ID` ) 
);

CREATE TABLE `Trades` (
`Trade_ID` INT NOT NULL AUTO_INCREMENT ,
`Trade_Name` VARCHAR( 255 ) NOT NULL ,
`Trade_URL` VARCHAR( 255 ) NOT NULL ,
`Trade_Domain` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `Trade_ID` )
);

CREATE TABLE `Clicks` (
`Gallery_ID` INT NOT NULL ,
`Trade_ID` INT NOT NULL ,
`Clicks` INT NOT NULL ,
`Used` INT NOT NULL ,
FOREIGN KEY ( `Gallery_ID` ) REFERENCES `Galleries` ( `Gallery_ID` ) ON UPDATE CASCADE ON DELETE CASCADE ,
FOREIGN KEY ( `Trade_ID` ) REFERENCES `Trades` ( `Trade_ID` ) ON UPDATE CASCADE ON DELETE CASCADE 
);
fireorange is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 07:50 PM   #2
willow
Confirmed User
 
Join Date: Dec 2001
Location: NY, NY, USA
Posts: 131
If your default table type isn't innodb, then add engine=innodb to the create statements.
willow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 08:00 PM   #3
fireorange
Confirmed User
 
Join Date: Jan 2005
Posts: 1,648
Quote:
Originally Posted by willow
If your default table type isn't innodb, then add engine=innodb to the create statements.
I tried adding TYPE=InnoDB at the end but it gets created as INNODB everytime.

Server version is: MySQL 3.23.58

Is it enabled by default in that version? Any command to check?
fireorange is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 08:07 PM   #4
willow
Confirmed User
 
Join Date: Dec 2001
Location: NY, NY, USA
Posts: 131
http://dev.mysql.com/doc/mysql/en/innodb-overview.html

You probably need to enable it. Have a read. If you can, move to 4.1.x, much nicer.
willow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 08:08 PM   #5
fireorange
Confirmed User
 
Join Date: Jan 2005
Posts: 1,648
Thanks I'll get my host to upgrade my server
fireorange is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 08:12 PM   #6
willow
Confirmed User
 
Join Date: Dec 2001
Location: NY, NY, USA
Posts: 131
Make sure you dump your tables out before the upgrade, or some other kind of backup. Good luck.
willow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-22-2005, 08:08 PM   #7
chompers
Confirmed User
 
Join Date: Jul 2005
Posts: 189
bump for posterity's sake

WOOOOOOOOOOOO WHOOOOOOOOOOOOOOOOOO!!!!!!!!!
chompers is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.