检索结果时,php查询崩溃

时间:2014-09-14 12:32:14

标签: php mysql

当我执行此查询时,代码在第'行崩溃$ row2 = mysql_fetch_array($ result2)' 有人可以帮我告诉我这里有什么问题。

$query2 = " SELECT time, MAX(id) FROM i_friend WHERE (user_id=$uid AND friend_id=$fid) OR (user_id=$fid AND friend_id=$uid) ";

                    $result2 = mysql_query($query2);

                    if($result2)
                    {
                             if (mysql_num_rows($result2) > 0) {
                                $row2 = mysql_fetch_array($result2) 
                                 detail["last_chat_time"] = $row2[$id];
                             } else {
                                 $detail["last_chat_time"] = "";
                             }
                    }

1 个答案:

答案 0 :(得分:0)

纠正这两行

 $row2 = mysql_fetch_array($result2);
 $detail["last_chat_time"] = $row2[$id];