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

Source: Internet
Author: User
The parameter is true, but there is still a warning mysql_fetch_row () expects parameter 1 to be resource?

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 ";

{
echo "";
echo "";
} else {
echo "";
echo "";
Return
}
$oldState = "Normal open";
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!
------to solve the idea----------------------
The SQL command executes
  • 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.