我怎么能把这两张桌子放在一起
$result = mysql_query("SELECT * FROM berichten where fromm='$id' AND ontvanger = '$session->username' ORDER BY date ASC");
$result = mysql_query("SELECT * FROM berichten_send where fromm='$id' AND ontvanger = '$session->username' ORDER BY date ASC");
这是我尝试过的但不是没有用的
$result = mysql_query("SELECT * FROM berichten LEFT JOIN berichten_send on berichten.id = berichten_send.id where fromm='$id' AND ontvanger = '$session->username' ORDER BY date ASC");
$number=mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{
echo $row['msg'];
echo "<br>";
echo time_stamp($row['date']);
echo "<br>-----------------------<br>";
}
答案 0 :(得分:0)
问题的最初部分显示两个表都有'fromm'和'ontvanger'字段。
mysql应该抱怨模糊的字段。
尝试
.... where berichten.fromm='$id' AND berichten.ontvanger = '$session->username'