PHP If condition judgment array return [FALSE]
{"Code": $, "message": "Success", "Data": [FALSE]}
$sql _notice=mysql_query (SQL statement)
$arrData =array ();
while ($arrData [] = mysql_fetch_array ($sql _notice))
{
$arrData;
}
$sData = Array_values ($arrData);
if (..... ){
Response::json (+, ' success ', $sData);
}else{
Response::json ("Error", "");
}
Note that [false] is not false
Because the previous should need to add []
This is done. The interface to the JSON return data while loop if there is an optimized wording, please advise
Now this is because if it does not match the return will be [false] try to use the same method as false to judge the result is not
How do you write this?
------to solve the idea----------------------
$arrData =array ();
while ($ $row = mysql_fetch_array ($sql _notice))
{
$arrData [] = $row;
}
if ($arrData) {
Response::json (+, ' success ', $arrData);
.....
I don't care what your purpose is, just care what format you need