0
更新的SQL輸出這兩個表的結果
SELECT listTitle, listLength, listCmt, listDt,mBCFName, mBCLName, moAmt
FROM User U
INNER JOIN Listing L on (U.uID = L.uID)
INNER JOIN MerchantOffer MO ON (L.listID = MO.listID)
INNER JOIN Merchant M on (M.mID = MO.mId)
GROUP BY listTitle
ORDER BY listDt DESC
LIMIT 0,5
稍微更新PHP
<?php
$result = $sth1->fetchAll(PDO::FETCH_ASSOC);
require_once('inc/php/timeAgo.php');
echo $then;
foreach($result as $row)
{
echo "<div class='listing'>";
print '<br>Title: ' . $row['listTitle'] . '<br>Comment: ' . $row['listCmt'] .
'<br><br>' . $days . ' days ' . $hours . ' hours ago' . '<br><br>' . '<br>Offer By: ' . $row['mBCFName']. ' ' . $row['mBCLName'] . '<br> for: ' . $row['moAmt'];
echo "</div>";
}
unset($sth1);
?>
給出類似的輸出: http://i.stack.imgur.com/pNfU5.png
它應該被輸出。 ..例如:
Title: Apple iPhone 4S
Comment: need this one quick!
15254 days 15 hours ago
Offer By: Diana Matthews
for: 194.99
Offer By: John Dickinson
for: 185.99
它爲什麼只得到第一個記錄和停止?
更多的輸出問題。你能看到我包括的上述*新*圖片嗎?它不顯示每個人的名字,如199.99,請參閱上面的內容! – Jay
@Jay,我不是在這裏以複製粘貼的形式爲你寫代碼,我只是指出'哦這是一種處理代碼的方法。 – Johan
我很欣賞Johan。請? – Jay