<?php if($_POST[login]){
mysql_select_db('users',$conn);
    $mingzi=$_POST['ues'];
$mima = $_POST['pwd'];

$result="select * from user where us_name = '$mingzi' and us_pwd='$mima'";//------查询返回数组类型。
//echo($result);

$query = mysql_query('$result',$conn);//执行没错返回资源类型
//var_dump($result);
//echo $query;
//$row = mysql_fetch_array($query);
$rows=mysql_fetch_assoc($query);
echo ($rows);

//$rs=mysql_fetch_assoc('$query');
//var_dump('$rs');

/*
if ($rows){
echo "<script>alert('登录成功!');window.location.href='add.php';</script>";
echo "欢迎.$mingzi.回来";
}else{
echo "<script>alert('用户名或密码错误!重新登录');window.location.href='add.php';</script>";
}
*/
}
为什么登录就是不行?返回的资源类型数组,如何判断啊?
下面是数据库的,就3个字段,能注册,就是登录不行!!!!!哪儿有问题,高低手帮我看看
uid tinyint(4) 否 无 AUTO_INCREMENT              
  us_name varchar(50) gbk_chinese_ci 否 无              
  us_pwd varchar(20) gbk_chinese_ci

解决方案 »

  1.   

    Notice: Use of undefined constant denglu - assumed 'denglu' in D:\www\php_Basic\message\add.php on line 4Notice: Undefined variable: conn in D:\www\php_Basic\message\add.php on line 5Warning: mysql_select_db() expects parameter 2 to be resource, null given in D:\www\php_Basic\message\add.php on line 7Notice: Undefined variable: conn in D:\www\php_Basic\message\add.php on line 32Warning: mysql_query() expects parameter 2 to be resource, null given in D:\www\php_Basic\message\add.php on line 42Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in D:\www\php_Basic\message\add.php on line 46Notice: Use of undefined constant rege - assumed 'rege' in D:\www\php_Basic\message\add.php on line 73Notice: Undefined index: rege in D:\www\php_Basic\message\add.php on line 88这PHP咋错误警告,乱七八糟这么多,还可以运行啊
      

  2.   

    $mingzi=isset($_POST['ues'])?$_POST['ues']:"";
      

  3.   

    你数据库没连接成功。。导致后面的等等错误。$conn在哪定义的?