How to run a set of SQL queries from a file, in PHP?
- by Harish Kurup
I have some set of SQL queries which is in a file(i.e query.sql), and i want to run those queries in files using PHP, the code that i have wrote is not working,
//database config's...
$file_name="query.sql";
$query==file($file_name);
$array_length=count($query);
for($i=0;$i<$array_length;$i++)
{
$data .= $query[$i];
}
echo $data;
mysql_query($data);
it echos the SQL Query from the file but throws an error at mysql_query() function...