本文介绍了mysql_num_rows()期望参数1为资源,字符串在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经阅读了许多其他有关此确切问题的话题,但是由于某种原因我无法解决我的问题.确实需要一些帮助.
I have read through many other threads about this exact problem, but i for some reason can not solve my problem. Really need some help.
if (!$username||!$password||!$email)
echo "Please fill out all fields";
else
{
//encrypt password
$password = md5($password);
//check if username already taken
$check = mysql_query("SELECT * FROM Test WHERE username = '$username'");
if (mysql_num_rows($check)>=1)
echo "Username already taken";
else
说
if (mysql_num_rows($check)>=1)
这行..但是当我在phpmyadmin中运行它时,它会向我返回结果.
if (mysql_num_rows($check)>=1)
This line..but when i run it in phpmyadmin, it returns results to me ok.
请帮助
推荐答案
尝试这样:
$query = "SELECT username FROM $this->table WHERE username='$sUser'";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
这篇关于mysql_num_rows()期望参数1为资源,字符串在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!