Here I have a tab1 table. I need to use PHP to get the SQL code to add all rows to the same table, where the field key1 = val1 . Is it possible to do something?

  • one
    Read the documentation for mysqldump, the standard mysql backup utility. there, among others, is the option --where='where_condition' - Mike
  • @Mike and how to access it via php? - devtwo
  • run using system or popen - Mike

1 answer 1

Reply from comments

You can use the mysqldump utility together with the - where key. You can run the utility from PHP either by using reverse quotes, or by calling it through the system() function

 <?php `mysqldump dbname tab1 --where='key1 = "val1"' > report.sql`;