php - I am trying to rerwrite this as a mysqli query but I keep getting an error -
i wrote query in php , mysql , works fine , returns data trying re-write mysqli function.
this come 500 error file.
if (mysqli_connect_errno()) { printf("could not talk database: ", mysqli_connect_error()); exit(); } $query("sql query works fine"); $data = array(); if ($result = $con->query($query)) { $tempdata = array(); while ($row = $result->fetch_object()) { $tempdata = $row; array_push($data, $tempdata); } echo json_encode($myarray); } /* free result set */ $result->close(); $con->close();
first problem see trying json_encode variable not exist. change $myarray
$tempdata
?
if debugging turned off error message go error_log saying undefined variable $myarray
Comments
Post a Comment