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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -