SELECT listTitle, listLength, listCmt, listDt, mBCFName, mBCLName, moAmt, moDtOff
FROM User U, Listing L, Merchant M, MerchantOffer MO
WHERE U.uID = L.uID
and L.listID = MO.listID
and M.mID = MO.mId
ORDER BY listDt DESC;
* 此foreach()循环 *
$result = $sth->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $row)
{
echo "<div class='listing'>";
print '<br>Title: ' . $row['listTitle'] . '<br>Comment: ' . $row['listCmt'] .
'<br>Date: ' . $row['listDt'] . '<br>Offer By: ' . $row['mBCFName']. ' ' .$row['mBCLName']. '<br> for: ' . $row['moAmt'];
echo "</div>";
}
产生 http://i.stack.imgur.com/FhMRQ.png(mod请显示图片)
基本上我想要的是:
Title: Apple iPhone 4S (listTitle)
Days: <some day amount <listLength>
Comment: some comment <listCmt>
Offer By: some user <mBCFName mBCLName>
Offer: 19.99 <moAmt>
Date: 10/03/2011 < moDtOff>
Offer By: some user <mBCFName mBCLName>
Offer: 19.99 <moAmt>
Date: 10/03/2011 < moDtOff>
Offer By: some user <mBCFName mBCLName>
Offer: 19.99 <moAmt>
Date: 10/03/2011 < moDtOff>
Offer By: some user <mBCFName mBCLName>
Offer: 19.99 <moAmt>
Date: 10/03/2011 < moDtOff>
查询1应包含 listTitle, listLength, listCmt, listDt
查询2应包含 mBCFName, mBCLName, moAmt, moDtOff