I use this PHP code to get value from my DB.
My problem is that i got null result.
I check for !empty($result) and for mysql_num_rows($result) but still i got null result.
I tested exactly the same query i use in my code on my phpmyadmin and it working.
The echo from $response["SQL"]
is "good".
Here is my PHP code:
$result = mysql_query("SELECT * FROM workouts_wall WHERE workout_name = 'WO13' AND user = 'tomer2'") or die (mysql_error());
// mysql inserting a 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);
Solved
I added this line to fix it:
$row = mysql_fetch_array($result);