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