0

使用 Facebook 图形 API 我有以下显示用户朋友本月的生日

SELECT uid, name,pic_square, birthday_date FROM user
WHERE (substr(birthday_date, 0, 2) = "04") AND uid IN
(SELECT uid2 FROM friend WHERE uid1 = me()) order by name

我真正想要展示的是接下来的 10 个生日,所以它可能会跨越几个月,因为月份接近尾声,但是,facebook 确实喜欢查询中的 NOW,所以我有点迷茫我将如何实现这一目标?

4

1 回答 1

0

我想通了——这就是你的做法!

$dd = date(d);

$mm = date(m);

SELECT uid, name,pic_square, birthday_date FROM user
WHERE (((substr(birthday_date, 0, 2) = "$mm") AND 
(substr(birthday_date, 3, 2) > "$dd") OR (substr(birthday_date, 0, 2) > "$mm")))
AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by birthday_date asc
于 2012-04-30T10:22:38.843 回答