GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   MySQL db problems (https://gfy.com/showthread.php?t=483967)

fireorange 06-22-2005 07:02 PM

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
);


willow 06-22-2005 07:50 PM

If your default table type isn't innodb, then add engine=innodb to the create statements.

fireorange 06-22-2005 08:00 PM

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?

willow 06-22-2005 08:07 PM

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.

fireorange 06-22-2005 08:08 PM

Thanks I'll get my host to upgrade my server :winkwink:

willow 06-22-2005 08:12 PM

Make sure you dump your tables out before the upgrade, or some other kind of backup. Good luck.

chompers 07-22-2005 08:08 PM

bump for posterity's sake

WOOOOOOOOOOOO WHOOOOOOOOOOOOOOOOOO!!!!!!!!!


All times are GMT -7. The time now is 09:19 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123