php - mysql query returning null when not should to [SOLVED] -


i use php code value db.

my problem got null result.

i check !empty($result) , mysql_num_rows($result) still got null result.

i tested exactly same query use in code on phpmyadmin , working.

the echo $response["sql"] "good".

here php code:

edit

i added line fix it:

$row = mysql_fetch_array($result); 

   $result = mysql_query("select * workouts_wall workout_name = 'wo13' , user = 'tomer2'") or die (mysql_error());           // mysql inserting new row          if (!empty($result))          {             if (mysql_num_rows($result) > 0)              {                 $response["sql"] = "good";             }             else             {                   $response["sql"] = "bad";             }         }          else             {             $response["sql"] = "bad";         }              $response["is null?"] = $result;             // echoing json response             echo json_encode($response); 

you can't return mysql_query results. must fetch data.

$data = array(); while ($row = mysql_fetch_array($result, mysql_assoc))     $data[] = $row;  echo(json_encode($data));  //edit: idea when done... mysql_free_result($result); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -