利用语句拆开来写:
(下述的代码通过验证可用)
$lguid=trim($lguid);
$lgpsd=trim($lgpsd);
$lgpsd=md5($lgpsd);
$qu="select userid,password from customer where userid='$lguid' and password='$lgpsd'";
$res=@mysql_query($qu,$link); 

解决方案 »

  1.   

    我试了一下没有问题啊,下面是我测试过程:
    mysql> create table if not exists tests(users varchar(10) binary not null,passwd
     varchar(50) binary not null);
    Query OK, 0 rows affected (0.04 sec)mysql> insert into tests values ('webmin',md5('12345'));
    Query OK, 1 row affected (0.01 sec)mysql> select * from tests;
    +--------+----------------------------------+
    | users  | passwd                           |
    +--------+----------------------------------+
    | webmin | 827ccb0eea8a706c4c34a16891f84e7b |
    +--------+----------------------------------+
    1 row in set (0.00 sec)mysql> select * from tests where passwd = md5('12345');
    +--------+----------------------------------+
    | users  | passwd                           |
    +--------+----------------------------------+
    | webmin | 827ccb0eea8a706c4c34a16891f84e7b |
    +--------+----------------------------------+
    1 row in set (0.00 sec)
      

  2.   

    请问你是在linux下执行的mysql
    还是在windows下执行的mysql?
    我在windows下执行没问题,
    但是在linux下执行失败
      

  3.   

    我在WinNT和RedHad Linux下都执行过了,没有问题。mysql 3.23.49-nt for Winnt,mysql 3.23.36 for linux。