0

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

?>

?>

4
Contributors
6
Replies
32
Views
2 Years
Discussion Span
Last Post by almostbob
0

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

Edited by santunu23

0

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

Edited by almostbob

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.