我在选择6个随机朋友时遇到问题
这是我到目前为止的查询:
$result = num_rows("SELECT * FROM friends WHERE member_id = '".$_SESSION['userid']."'"); if($result >= 6) { $f_num = 6; } else { $f_num = $result; } for($i = 1; $i <= $f_num; $i++) { $q_get_member_friends = MysqL_query("SELECT * FROM friends WHERE member_id = '".$_SESSION['userid']."' ORDER BY rand() LIMIT 1"); $r_get_member_friends = MysqL_fetch_array($q_get_member_friends); echo $r_get_member_friends['friend_with']; }
暂时坚持这一段时间:/
谢谢你的帮助 :)