麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
强烈请求高手帮忙看看这句mysql查询语句错在哪里??
悬赏分:20 - 2007年08月13日

[php] $q="select f.ffusername,f.object,f.click,f.photo,f.photopath,u.username,u.user_gender,u.user_birthday,(TO_DAYS(now())-TO_DAYS(FROM_UNIXTIME(u.user_birthday*86400+1,'%Y%m%d')))/365 as birth from ".$user_prefix."_user_profile1 as f LEFT JOIN ".$user_prefix."_users as u on u.username=f.ffusername where u.user_birthday!='999999' "; $str2=""; if($sexs>0 AND $sexs<3){ $str2=$str2." and u.user_gender='$sexs'"; } if($photos>1){ $str2=$str2." and f.photo=1"; } if($age1>=1){ if($age2>$age1){ $str2.=" and birth between '$age1' and '$age2'"; } elseif(($age2<=$age1)||$age1=""||$age2=""||$age1<=0||$age2<=0){ echo ""._UNEXPECTAGE.""; echo "
"; } } $q=$q.$str2; $q.=" order by f.click desc limit $min,$offset"; [/php] 以下是echo出来的查询语句: [php] select f.ffusername,f.object,f.click,f.photo,f.photopath,u.username,u.user_gender,u.user_birthday,(TO_DAYS(now())-TO_DAYS(FROM_UNIXTIME(u.user_birthday*86400+1,'%Y%m%d')))/365 as birth from nuke_user_profile1 as f LEFT JOIN nuke_users as u on u.username=f.ffusername where u.user_birthday!='999999' and birth between '18' and '35' order by f.click desc limit 0,20 [/php] 目前就是是查询没有结果,问题主要集中年龄范围的查找,即在user_birthday的转换上有问题,因为user_birthday是一个类似UNIX时间戳的值(比如19770418的在user_birthday上值为2664),必须要转换为标准时间格式才能被TO_DAYS()使用,我看了很久,也翻了一些资料,死活没看出来,请大家帮忙看看问题该怎么解决,不胜感激!!

提问者:free123   08-13 19:07
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
37 + 6 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM