This question already has an answer here:
i am new to php and really need help on the below.
echo "Running Database Script...";
flush();
$dbms_schema = "../../sql/schema.sql";
$sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema)) or die('Cannot find SQL schema file. ');
$sql_query = remove_remarks($sql_query);
$sql_query = remove_comments($sql_query);
$sql_query = split_sql_file($sql_query, ';');
$con = mysqli_connect($servername,'root',$rootpass) or die('error connection');
$i=1;
foreach($sql_query as $sql){
//echo $i++;
//echo " ";
//echo $sql;
//echo "<br>";
mysqli_query($con,$sql) or die('error in query');
}
//mysqli_close($con);
echo "Success!<br>";
flush();
getting the below result with the mysqli_query($con,$sql) part...
Running Database Script...error in query
</div>