0

我怎样才能把这两张桌子放在一起

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

}  
4

1 回答 1

0

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

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

尝试

.... where berichten.fromm='$id' AND berichten.ontvanger = '$session->username'
于 2013-09-22T09:41:40.593 回答