管理者:次の出力を達成しようとしている画像として画像のURLを作成してください:
//
Joseph Dickinson
Title: Need Xbox 360
Comment: I need one quick!
on 2011-09-15
John Doe 149.99
Jane Doe 154.99
Diana Matthews 160.00
Amanda Koste 174.99
//
現在、「John Doe 149.99」や「Jane Doe 154.99」など、オファーごとに「Joseph Dickinson」という名前が書かれています。それぞれに1回欲しい、「Xbox 360が必要」のようなタイトル http://i.stack.imgur.com/ERLbX.png
このページは、php ファイルを通じてこの情報を収集します。
<?php require_once('inc/db/dbc.php'); ?>
<?php
#GET User (Buyer) Info and General Listing Info
$pdo = new PDO($h1, $u, $p);
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth = $pdo->prepare('
SELECT uFName, uLName, listTitle, 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
LIMIT 0,5
;');
$sth->execute(array());
?>
私が使っているPHP
<?php $usrBrowser = $_SERVER['HTTP_USER_AGENT']; $todayDt = date('Y-m-d'); ?>
<form id="AddListing" method="post" action="#">
<input type="hidden" name="theUserID" value="" /> <br>
Product Wanted: <input type="text" name="ListingTitle" /> <br>
Listing Length:<?php require_once('inc/php/listingLengths.php'); ?>
Cost: <input type="text" name="ProductAskingPrice" /> <br>
Shipping: <input type="text" name="ProductAskingShipAmount" /> <br>
Additional Comment: <input type="text" name="ListingComment" /> <br>
<input type="hidden" name="ListingDateOfEntry" value="<?php echo $todayDt; ?>" /> <br>
<input type="hidden" name="ListingUserBrowserType" value="<?php echo $usrBrowser; ?>" /> <br>
<input type="submit" value="List" />
</form>
<?php
$result = $sth->fetchAll(PDO::FETCH_NUM);
#print_r($result); //or var_dump($result); for more info
foreach($result as $row){
$half = array_splice($row,0,5);
echo implode("<br> ",$half)."<br />".implode(" ",$row);
}
?>
上記の方法で出力するにはどうすればよいですか?配列インデックスを使用する方が簡単でしょうか? // // 上記を達成するにはどうすればよいですか? http://i.stack.imgur.com/dBhyx.png