Jump to content
#FlattenTheCurve ×
jarv

help exporting table as SQL file?

Recommended Posts

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;
}

Share this post


Link to post
Share on other sites

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 by ginerjm

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.