参数确实是true,但是还是有警告mysql_fetch_row() expects parameter 1 to be resource?
<br />function checkCancelUserStop($phoneNum)<br />{<br /> $con = mysql_connect("localhost", "root", "");<br /> if(!$con)<br /> {<br /> echo "<script language=\"JavaScript\"><br /> alert('数据库连接失败!'); <br /> </script>";<br /> echo "<script language='javascript' type='text/javascript'>";<br /> echo "window.location.href='$url'";<br /> echo "</script>";<br /> return;<br /> } <br /> $result = mysql_select_db ("teleservice",$con);<br /> if(!$result)<br /> {<br /> echo "<script language=\"JavaScript\"><br /> alert('选择数据库失败!'); <br /> </script>";<br /> echo "<script language='javascript' type='text/javascript'>";<br /> echo "window.location.href='$url'";<br /> echo "</script>";<br /> return;<br /> }<br /> $result = mysql_query("SET NAMES 'GBK'");<br /> if(!$result)<br /> {<br /> echo "<script language=\"JavaScript\"><br /> alert('设置字符集失败!'); <br /> </script>";<br /> echo "<script language='javascript' type='text/javascript'>";<br /> echo "window.location.href='$url'";<br /> echo "</script>";<br /> return;<br /> }<br /> $query = "select state<br /> from phoneDetail<br /> where phoneDetail.phoneNum = $phoneNum";<br /> if($result) <br /> {<br /> echo "<script language=\"JavaScript\"><br /> alert('查询号码原状态成功!'); <br /> </script>";<br /> echo "<script language='javascript' type='text/javascript'>";<br /> echo "window.location.href='$url'";<br /> echo "</script>"; <br /> } else {<br /> echo "<script language=\"JavaScript\"><br /> alert('查询号码原状态失败!'); <br /> </script>";<br /> echo "<script language='javascript' type='text/javascript'>";<br /> echo "window.location.href='$url'";<br /> echo "</script>";<br /> return;<br /> }<br /> $oldState = "正常开通";<br /> while($row = mysql_fetch_row($result))<br /> {<br /> echo "in while loop...";<br /> $oldState = $row[0];<br /> echo $oldState;<br /> }<br /> if($oldState == "主动停机") {<br /> echo "yes";<br /> return true;<br /> } else {<br /> echo "no";<br /> return false;<br /> }<br /> mysql_close($con);<br />}