0

This is my php code

//DONT EDIT BELOW THIS LINE
//Export the database and output the status to the page
$command='mysqldump --opt -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' > ~/' .$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;
}
?>

when i try to execute this file. this error showing . "Strict standards: Only variables should be passed by reference in C:\wamp\www\dbest.php on line 12"

why this error showing? please helep me... thanks

Shahulktm
  • 303
  • 3
  • 5
  • 14
  • Because of `$output=array()`. That's an expression, not a referencable variable. Don't try to inline-initialize it with the exec() call. – mario Nov 15 '13 at 06:03

1 Answers1

1

The value of an assignment expression is the value assigned

Assignment Operators

$output=array() is expression which returns value(empty array) but not variable. So it cannot be used as argument for fuctnions which gets this argument by reference.

But you could try to use this bug.

Community
  • 1
  • 1
sectus
  • 15,605
  • 5
  • 55
  • 97