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

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;"
  4. cat databasedump.sql
  6. echo "COMMIT;"
  7. echo "SET AUTOCOMMIT=1;"
  8. ) | mysql --user=username --password=password database

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,

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

P: 348
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.