PHP If condition judgment array back to [false]

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.