this is a php script for import .sql file in mysql but suddenly it doesn't work what i am doing wrong browser show false messege

<?php
//ENTER THE RELEVANT INFO BELOW
$mysqlDatabaseName ='trigger';
$mysqlUserName ='username';
$mysqlPassword ='mypassword';
$mysqlHostName ='localhost';
$mysqlImportFilename ='event.sql';

$command='mysql -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' < ' .$mysqlImportFilename;
exec($command,$output=array(),$worked);
switch($worked){
    case 0:
        echo 'Import file <b>' .$mysqlImportFilename .'</b> successfully imported to database <b>' .$mysqlDatabaseName .'</b>';
        break;
    case 1:
        echo 'false';
        break;
}

?>

?>

sorry to mention it return statement is "false"

Also, are you sure that the user has priviledge to do what you are doing to the server?

yes taywin i have enough privilige on my server don't know why this code is not working????????/

op line 9

$command='mysql -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' < ' .$mysqlImportFilename;

returns
mysql -hlocalhost -uusername -pmypassword trigger < event.sql

compare to possible fix

$command='mysql -h '.$mysqlHostName .' -u '.$mysqlUserName .' -p '.$mysqlPassword.' '.$mysqlDatabaseName.' < '.$mysqlImportFilename;

returns
mysql -h localhost -u username -p mypassword trigger < event.sql

to my mind, better

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.