$sql="select * from zhgr where LENGTH(shanchu)=0 and shid='$profile_name' order by id desc limit $offset,$psize";

解决方案 »

  1.   


    $sql="select * from zhgr where IFNULL(shanchu,0)=0 and shid='$profile_name' order by id desc limit $offset,$psize";
      

  2.   

    不是没有用,是你建表的时候没有把shanchu 默认为空
    create table 'zhgr'('shanchu' varchar(长度) default NULL........................然后这句应该是有用的
    $sql="select * from zhgr where IFNULL(shanchu,0)=0 and shid='$profile_name' order by id desc limit $offset,$psize";
      

  3.   

    应该仔细看看你的shanchu字段,在数据库里到底使怎么保存的。不然应该不会有问题吧!
      

  4.   

    上面的例子我试了,还是不可以 shanchu  char(2)   是  NULL    
    这是从PHPMYADMIN中查看的
      

  5.   

    where shanchu IS NULL__________________________________
    谢谢,这样一改就可以了
      

  6.   

    要晕了,
    $psize=20;
    $sql="select count(*) from dxx where shanchu IS NULL shid='$profile_name'";
    $result=mysql_query($sql,$link);
    $num=mysql_fetch_row($result);
    $num_rows=$num[0];
    在写分页的时候这样写居然又报错Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in 
      

  7.   

    $sql="select count(*) from dxx where shanchu IS NULL and shid='$profile_name'";
      

  8.   

    $sql="select count(*) from dxx where shanchu IS NULL
    and  //----------> 这里漏了
     shid='$profile_name'";
      

  9.   

    哈哈,真是昏了,and 没有注意到,谢谢各位!~~