By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

innodb and php

100+
P: 348
Hi all,

I have a question regarding php and mysql. What I have is a php backup script that dumps the data in the form of INSERT INTO ...

I am using innodb and foreign key constraints. When the user downloads the sql file for the db, the tables are not in the order that they need to be for the restore. The restores will always fail because of the foreign key constraints.

I am developing on a windows machine and will host in a UNIX environment. In the mean time, can someone tell me how I can inplement this code using php to turn off the constraints?

Expand|Select|Wrap|Line Numbers
  1.  (
  2. echo "SET AUTOCOMMIT=0;"
  3. echo "SET FOREIGN_KEY_CHECKS=0;"
  4. cat databasedump.sql
  5. echo "SET FOREIGN_KEY_CHECKS=1;"
  6. echo "COMMIT;"
  7. echo "SET AUTOCOMMIT=1;"
  8. ) | mysql --user=username --password=password database
  9.  

Heck, I may as well ask as long as I am here.. Is it ok to use php's exec func for the restore or is there a better way?

Thank you,

Frank
Sep 17 '07 #1
Share this Question
Share on Google+
1 Reply


100+
P: 348
fjm
The word for the day is "Concatenation".

I got it guys... Thanks!
Sep 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.