|
|
|
||||
|
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. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
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 ); |
|
|
|
|
|
#2 |
|
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.
|
|
|
|
|
|
#3 | |
|
Confirmed User
Join Date: Jan 2005
Posts: 1,648
|
Quote:
Server version is: MySQL 3.23.58 Is it enabled by default in that version? Any command to check? |
|
|
|
|
|
|
#4 |
|
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. |
|
|
|
|
|
#5 |
|
Confirmed User
Join Date: Jan 2005
Posts: 1,648
|
Thanks I'll get my host to upgrade my server
|
|
|
|
|
|
#6 |
|
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.
|
|
|
|
|
|
#7 |
|
Confirmed User
Join Date: Jul 2005
Posts: 189
|
bump for posterity's sake
WOOOOOOOOOOOO WHOOOOOOOOOOOOOOOOOO!!!!!!!!! |
|
|
|