The parameter is true, but there is still a warning mysql_fetch_row () expects parameter 1 to be resource?

Source: Internet
Author: User
function Checkcanceluserstop ($phoneNum) {$con = mysql_connect ("localhost", "root", ""), if (! $con) {echo ""; echo ""; return;} $result = mysql_select_db ("Teleservice", $con), if (! $result) {echo ""; echo "; return;} $result = mysql_query ("SET NAMES ' GBK '"), if (! $result) {echo ""; echo "; return;} $query = "Select state from  phonedetail  where phonedetail.phonenum = $phoneNum"; if ($result) {echo ""; echo "";} else {echo "; echo" "; return;} $oldState = "Open normally", while ($row = Mysql_fetch_row ($result)) {echo ' in while loop ... ' $oldState = $row [0];echo $oldState;} if ($oldState = = "Active Stop") {echo "yes"; return true;} else {echo "no"; return false;} Mysql_close ($con);}


Problem: Through debugging, the original status of the number can already be queried successfully. At this time $result = 1, but the back fetch_row, cannot enter into the while loop, there is a warning: warning:mysql_fetch_row () expects parameter 1 to be resource, Boolean given in H:\wamp\www\frr_cancelUserStop.php on line 58
Ask: $result = 1 is really 1 (true) Ah, then why not into the loop?
How can we get results?
Thank you, everyone!


Reply to discussion (solution)

I know how to be wrong, write a few words. Excuse me.

The SQL command executes

I have also encountered this kind of mistake, can I help to look?
Warning:mysql_fetch_row () expects parameter 1 to BES resource, boolean given in D:\WWW\blog\show_pub.php on line 7
Code:
Error_reporting (E_all^e_notice);
Session_Start ();
Include "conn/conn.php";
$pubsql = "SELECT * from Tb_public where id=". $_get[' id '];
$pubrst = mysql_query ($pubsql, $link);
$pubrow = Mysql_fetch_row ($pubrst);
echo "

". $pubrow [2]."
";
?>
  • 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.