I need to run a SQL file (to create a user) from within my PHP. I know how this is done:
$commands = file_get_contents("sql/create_usr.sql")
$commands = explode(";", $commands);
foreach($commands as $command){
if($command){
$success += (@mysql_query($command)==false ? 0 : 1);
$total += 1;
}
}
How do I run the SQL file with specific parameters (e.g. username, password) from a PHP file. Thanks in advance.
if(trim($command))? The entire ext/mysql PHP extension, which provides all functions named with the prefix mysql_, is officially deprecated as of PHP v5.5.0 and will be removed in the future.