When I execute this query the code crashes at line ' $row2 = mysql_fetch_array($result2) ' Can someone please help me tell what is wrong in this.
$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"] = "";
                             }
                    }
 
     
    