0

I am Trying to get backup of mysql database table using php script below but by executing this script it is creating the backup file but with no data in it .Any idea how to overcome this please help me out. enter image description here

Script

<?php

echo exec('mysqldump -u[root] -p[123456789] -h[localhost] [Android] [houseDetails] --where="addedDate=\'2013-11-22 09:17:28\'"> houseDetails.sql');

?>
11
  • in the flag --where you specify that you only want fields that have the exact date to be 2013-11-22 09:17:28. You might want to specify a date range or something like addedDate >= "2013-11-22 00:00:00" or --where="addedDate BETWEEN '2013-11-22 00:00:00' and '2013-11-23 00:00:00'" Commented Oct 10, 2014 at 9:03
  • And is your column name really addedDate or rather added_date? Commented Oct 10, 2014 at 9:05
  • still not getting records in file my column name is same that i had mention in my question. Commented Oct 10, 2014 at 9:06
  • please execute a select with the given where condition on your table and check if you get results........ Commented Oct 10, 2014 at 9:07
  • If you do not get results in your select then you will not get results here also. Commented Oct 10, 2014 at 9:07

1 Answer 1

1

Try this:

shell_exec("mysqldump -u root -ppassword db_name table_name --where=\"post_date in ('2011-12-15 06:14:55')\" > /tmp/test.sql");
Sign up to request clarification or add additional context in comments.

5 Comments

still generating empty file
i am uploading database image so please check it
echo exec('mysqldump -u[root] -p[123456789] -h[localhost] [Android] [houseDetails] --where=" addedDate in ('2013-11-22 09:17:28')"> houseDetails.sql');
Try this: echo exec('mysqldump -u[root] -p[123456789] -h[localhost] [Android] [houseDetails] --where=" addedDate in ('2013-11-22')"> houseDetails.sql');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.