jarv Posted July 8, 2016 Share Posted July 8, 2016 I am getting an error to check my values but I am using the right username, password, table name and host name. Can anyone help me here? $mysqlDatabaseName ='drupal'; $mysqlUserName ='drupal'; $mysqlPassword ='xxx'; $mysqlHostName ='localhost'; $mysqlExportPath ='content_type_vacancy.sql'; $command='mysqldump --opt -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' content_type_vacancy > ~/' .$mysqlExportPath; exec($command,$output=array(),$worked); switch($worked){ case 0: echo 'Database <b>' .$mysqlDatabaseName .'</b> successfully exported to <b>~/' .$mysqlExportPath .'</b>'; break; case 1: echo 'There was a warning during the export of <b>' .$mysqlDatabaseName .'</b> to <b>~/' .$mysqlExportPath .'</b>'; break; case 2: echo 'There was an error during export. Please check your values:<br/><br/><table><tr><td>MySQL Database Name:</td><td><b>' .$mysqlDatabaseName .'</b></td></tr><tr><td>MySQL User Name:</td><td><b>' .$mysqlUserName .'</b></td></tr><tr><td>MySQL Password:</td><td><b>NOTSHOWN</b></td></tr><tr><td>MySQL Host Name:</td><td><b>' .$mysqlHostName .'</b></td></tr></table>'; break; } Quote Link to comment https://forums.phpfreaks.com/topic/301455-help-exporting-table-as-sql-file/ Share on other sites More sharing options...
ginerjm Posted July 8, 2016 Share Posted July 8, 2016 (edited) Perhaps if you turn on error checking you might get something that could help? Also - in that error message code consider echoing the actual command to ensure it is correct. Also - the syntax I just checked shows a space after each switch. Plus you are including a last parm that seems to be repetitive. Edited July 8, 2016 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/301455-help-exporting-table-as-sql-file/#findComment-1534365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.