求助:建站问题 php代码执行失败
请朋友们帮我找找下面这段代码的错误之处,辛苦各位了!<?phpsession_start();$_SESSION['username']=$_POST["username...
请朋友们帮我找找下面这段代码的错误之处,辛苦各位了!
<?php
session_start();
$_SESSION['username']=$_POST["username"];
$_SESSION['password']=$_POST["password"];
$db=mysql_connect("localhost","root","mysql");
mysql_select_db("mysql",$db);
$sql=mysql_query("select username,password from user where username=$name and password=$password",$db);
$result=mysql_query($sql,$db);
$row=mysql_num_rows($result);
if($row>0)
{
echo '<script>window.location.href="imformation.php";</script>';
}
else
{
echo '<script>window.location.href="main.html";</script>';
}
?>
图片所示是执行以上代码后出现的。 展开
<?php
session_start();
$_SESSION['username']=$_POST["username"];
$_SESSION['password']=$_POST["password"];
$db=mysql_connect("localhost","root","mysql");
mysql_select_db("mysql",$db);
$sql=mysql_query("select username,password from user where username=$name and password=$password",$db);
$result=mysql_query($sql,$db);
$row=mysql_num_rows($result);
if($row>0)
{
echo '<script>window.location.href="imformation.php";</script>';
}
else
{
echo '<script>window.location.href="main.html";</script>';
}
?>
图片所示是执行以上代码后出现的。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询