mysql_select_db("homework", $conn)
mysql_query("SET NAMES 'UTF8'",$conn)
$username=$_POST['user_email']
$password=$_POST['password']
$sql = "select * from user where username='$username' and password='$password'"
$Result = mysql_query($sql, $conn)
$onerow = mysql_fetch_array($Result)
if ( $onerow )
echo "正确"
else
echo "错误"
$con = mysql_connect("localhost","lqq","147258")if (!$con)
{
die('Could not connect: ' . mysql_error())
}
mysql_select_db("dreamer", $con)//connect to database dramer.
$name=$_POST["username"]//username来自表单
$pwd=$_POST["password"]//password来自表单
if($name && $pwd)
{
$query=mysql_query("SELECT * FROM usr where name='$name' and pwd='$pwd'")
if($rows=mysql_fetch_array($query))
{
header("refresh:0url=indexin.php")
exit
}
else
{
echo "<script language=javascript>alert('用户名or密码错误')history.back()</script>"
}
}
我想是你sql有错,你试试换成这样的试试、
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)