Home  >  Article  >  Backend Development  >  mysql_num_rows()函数,该如何处理

mysql_num_rows()函数,该如何处理

WBOY
WBOYOriginal
2016-06-13 12:42:04933browse

mysql_num_rows()函数

以下是代码部分:
$username=$_POST["name"];
$password=$_POST["password"];
if($username&&$password)
{
if(strpos($username," ")!==false)echo "用户名非法";
else
{
$con=mysql_connect("localhost","root","1");
mysql_select_db("manage",$con);
$sql="
select password
from user
where username='$username'
";
$query=mysql_query($sql);
$row=mysql_num_rows($query);
if($row!=0)echo'登录成功';
  else
  echo '登录失败';
}
}
?>

php MySQL
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn