<?php
  include ("conn.php");
  $name=$_POST['loginname'];
  $pass=$_POST['password'];
    $ssql=mysql_query("SELECT id FROM admin where name=".$_POST['loginname'].",pass=".$_POST['password']."");
    $row=mysql_fetch_array($ssql);    if(empty($row)){
?> 
 <script>alert('User name or password mistake!');/*window.location.href='http://localhost/iatfglobaloversight/admin/index.html';*/</script>
<?php }else{
?>
  <script>alert('Login success!');window.location.href='http://localhost/iatfglobaloversight/admin/rowlist.html';</script>
<?php }?>

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Program Files\Apache2.2\htdocs\iatfglobaloversight\admin\Login.php on line 6
如上代码.... 如上错误....我实在是找不到,哪有错误!

解决方案 »

  1.   

    SELECT id FROM admin where name=".$_POST['loginname']." AND pass=".$_POST['password']试看看
      

  2.   

    mysql_fetch_array()函数使用的不是一个有效的结果集
      

  3.   

    <?php
      include ("conn.php");
      $name=$_POST['loginname'];
      $pass=$_POST['password'];
        $ssql=mysql_query("SELECT id FROM admin where name='$name' and pass='$pass'");
        $row=mysql_fetch_array($ssql);    if(empty($row)){
    ?> 
     <script>alert('User name or password mistake!');/*window.location.href='http://localhost/iatfglobaloversight/admin/index.html';*/</script>
    <?php }else{
    ?>
      <script>alert('Login success!');window.location.href='http://localhost/iatfglobaloversight/admin/rowlist.html';</script>
    <?php }?>