我是PHP編程的新手。我使用FQL查詢來獲取所有用戶的朋友的生日。 但我想根據月份和日期對用戶進行排序。這可以在多維數組中嗎?我想要:使用FQL的Facebook PHP SDK生日APP
$year = array('jan' => array('1' => array(data returned by fql query), '2' => array(data returned by fql query),..etc), 'feb' => array('1' => array(data returned by fql query)), 'mar' => array(), etc);
這可能嗎? 我迄今爲止代碼:
$query = "SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND strlen(birthday_date) != 0 ORDER BY birthday_date";
$year =array();
$prm = array(
'method' => 'fql.query',
'query' => $query,
'callback' => ''
);
$friends = $facebook->api($prm);
for($m = 1;$m <= 12;$m++){
$dm = mktime(0,0,0,$m,26);
$dm = date("M", $dm);
$year[] = $dm;
for($d = 1;$d <= 31;$d++){
$a2 = array($d => array());
$a3 = $out[$dm];
array_push($out,array($dm => array($d => "")));
}
}
PS:我希望能夠通過月的一天,以表示每個月的生日在一個div,訂購。 謝謝。
爲什麼你不想使用order by子句? – 2011-04-04 17:06:54