请大家帮帮忙,看看这段php代码到底哪里出错了!

来源:百度知道 编辑:UC知道 时间:2024/05/26 09:23:38
<?php
include("config.php");
?>
<?php
if(empty($_GET["id"])){
echo ("<script type='text/javascript'> alert('用户名怎么能是空的

呢!');history.go(-1);</script>");
}
if(empty($_GET["pws"])){
echo ("<script type='text/javascript'> alert('密码也不能是空

的!');history.go(-1);</script>");
}
$id= $_POST["id"]; //用户名已经记录了
$pws= $_POST["pws"]; //密码已经记录了
$db=mysql_connect($servername,$sqlservername,$sqlserverpws);
mysql_select_db($sqlname,$db);
$sql="select * from $sqltable where id='$id' and pws='$pws'";
$result=mysql_fetch_array(mysql_query($sql));

if(!$result){
echo ("<script type='text/javascript'> alert('用户名或密码不正

确!');history.go(-1);</script>");
mysql_close();
exit;
}
ses

mysql_select_db($sqlname,$db); ??
有这样链接的吗?

<?php
$id=mysql_connect("localhost","root","root")
if(mysql_select_db("db_database02",$id))
mysql_query("set names gb2312");
?>

楼主按我的方法改一下~

$id= $_POST["id"]; //用户名已经记录了
$pws= $_POST["pws"]; //密码已经记录了
你用的传值方式是GET就应该改为如下:
$id= $_GET["id"]; //用户名已经记录了
$pws= $_GET["pws"]; //密码已经记录了
楼主试试
你的$_POST数组里面是空的 $_GET数组里面才有内容啊
希望对你有帮助!