关于session的问题!

Y3721 2005-07-15 08:35:15
<?
$usse=$_POST['username'];
$pwd=$_POST['password'];
$db=mysql_connect("localhost");
mysql_select_db("Examine",$db);
$result=mysql_query("select user_pwd from user where user_name='$usse'");
if(mysql_num_rows($result)!=1)
{
echo "对不起,不存在此姓名的用户!";
//err_output("the user name is not have");
}
else
{
$arruser=mysql_fetch_array($result);
if($arruser["user_pwd"]!=$pwd)
{
echo "Sorry,密码错误!";
//err_output("The password is wrong");
}
else
{
session_start();
$_SESSION['user_name']=$user_name;
echo $user_name;
}
}
?>



echo $user_name
没有输出任何数据!
不知道是哪里的问题!请大家多多指教!!
...全文
151 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhrn 2005-07-15
  • 打赏
  • 举报
回复
将$_SESSION['user_name']=$user_name 中的
$user_name改为$arruser['user_name']
rardge 2005-07-15
  • 打赏
  • 举报
回复
楼主,请问一下,你的$user_name在哪里被赋值了?
你根本就是在显示一个空变量么!
Y3721 2005-07-15
  • 打赏
  • 举报
回复
我想问的问题是session的问题啊!
不是链接数据库的问题1
eingmarra 2005-07-15
  • 打赏
  • 举报
回复
$db=mysql_connect("localhost");

难到您的数据库没有用户名或密码??


echo $usse=$_POST['username'];
echo $pwd=$_POST['password'];
echo $db=mysql_connect("localhost");
mysql_select_db("Examine",$db);
echo $result=mysql_query("select user_pwd from user where user_name='$usse'");

显示在网叶上可能对你有启发!
注意:session语句要注释掉,不燃会出错的哦!

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧