@$sql = sprintf("select count(*) as count from user u where u.user = '%s' and u.password = '%s'",
mysql_real_escape_string($account),
mysql_real_escape_string($password));这个语句没有@ 会有警告错误。
sql 打印的结果是select count(*) as count from user u where u.user = '' and u.password = ''账号 密码是确定传来值的。
  我的环境是php5 + apache2.2

解决方案 »

  1.   

    如果确定SQL没有问题的话,你不要用@屏蔽
    另外,楼主已经发现报错了,为何不将错误代码贴出来大家看看呢
    楼上的是一个原因,如果escape后SQL语句有些问题
      

  2.   

    数据库连接成功
    //@$sql = sprintf("select count(*) as count from user u where u.user = '%s' and u.password = '%s'",
    //mysql_real_escape_string($account),
    //mysql_real_escape_string($password));
    $sql = "select count(*) as count from user u where u.user = '". $account ."' and u.password = '". $password ."'";两种方式都用过。只有下面这种成功执行。
      

  3.   

    自问自答
    mysql_real_escape_string ( string unescaped_string [, resource link_identifier])
    这个函数还要接收一个资源句柄。
       用mysql_escape_string() 更合适