我怎么能把这两个桌子放在一起

$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>";

}

最佳答案

问题的初始部分显示两个表都具有“ fromm”和“ ontvanger”字段。

mysql应该抱怨不明确的字段。

尝试

.... where berichten.fromm='$id' AND berichten.ontvanger = '$session->username'

10-07 21:02