homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Disabling Foreign Key Constraints
How to enable/disable foreign keys
calmseas




msg:4196653
 9:53 pm on Sep 4, 2010 (gmt 0)

I have a table in phpMyAdmin that has a primary key. I'd like to drop the table to prepare for a new import; but I can't do that without disabling the table's associated foreign keys; otherwise I get constraint errors. I can disable a foreign key by simply temporarily deleting the key in the associated table. However, is there a simpler way of enabling/disabling foreign keys in phpMyAdmin. If not, what is the simplest way of automating this mundane task?

 

Little_G




msg:4196660
 10:34 pm on Sep 4, 2010 (gmt 0)

Hi,

You should be able to use the query:
SET FOREIGN_KEY_CHECKS=0;
To disable foreign key checks, set it to one to re-enable after you've finished.

Andrew

calmseas




msg:4196855
 6:20 pm on Sep 5, 2010 (gmt 0)

Excellent!...............thank you.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved