php+mysql 查询一个多条件的结果要怎么写
这个怎么改$sql="select*fromshbwhereusername=$usernameanddate('Y-m-d',starttime)=date('Y-m-...
这个怎么改
$sql="select * from shb where username=$username and date('Y-m-d',starttime)=date('Y-m-d',$starttime) and starttime<$setouttime && starttime>=$setintime-$spacetime"; 展开
$sql="select * from shb where username=$username and date('Y-m-d',starttime)=date('Y-m-d',$starttime) and starttime<$setouttime && starttime>=$setintime-$spacetime"; 展开
展开全部
$sql="select * from shb where username='$username' and datediff(now(),starttime)=0 and starttime<'$setouttime' and starttime>=$'".(setintime-$spacetime)."'";
追问
谢谢,这么写明朗多了,不过后面运行还是出错
$rs=mysql_query($sql);
$rows=mysql_num_rows($rs);
运行结果:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\apmxe\htdocs\myweb\shb.php on line 43
43行是
$rows=mysql_num_rows($rs);
是$sql语句还有错?
追答
什么样?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询