用户登录/*1. 获取客户端传过来的参数*/
$name=$_POST["userid"];
print($name);
if($name!="")
{
$pw = $_POST["password"];
$sql = "select * from test where id=$name and name='$pw'";
print($sql."
");
/*2. 开始创建连接*/
$conn=mysql_connect("localhost","root","321");
mysql_select_db("php",$conn) or die("cant");
$result = mysql_query($sql,$conn) or die(mysql_error());
$num=mysql_numrows($result); //返回记录个数
#mysql_close($conn);
print("记录行数:".$num);
if($num>0){
echo "ok";
}else {
echo "down";
}
} else {
}
mysql_close($conn);
?>
阅读(1211) | 评论(0) | 转发(0) |