On Jul 28, 2009, at 12:48 PM, Jim Lucas wrote:
<?php
$item_list = "";
$cats = array('01100-01200-01300-06403', '01100-02201-01300-06403');
echo '<table border="1">';
echo '<tr>';
foreach ( $cats AS $cat ) {
echo '<th>'.htmlspecialchars($cat).'</th>';
}
echo '</tr><tr>';
foreach ( $cats AS $cat ) {
echo '<td>';
$cat = mysql_real_escape_string($cat, $db);
$SQL = "SELECT itemid,description,unitprice
FROM catalog
WHERE categories='$cat'
ORDER BY itemid";
if ( ($result = mysql_query($SQL, $db)) !== false ) {
while ( $item = mysql_fetch_assoc($result) ) {
$price = money_format('%i', $item['unitprice']);
echo <<<ROW
<a href="shop.cgi?c=detail.htm&itemid={$item['itemid']}"
>{$item['description']}</a>
ROW;
}
} else {
echo "No results for category #{$cat}!";
}
echo '</td>';
}
echo '</tr></table>';
?>
We're getting close! This now displays everything in 2 columns.
Ultimately, what I need is a display like this:
Starter Units Add-On Units
Item# Description Price Item# Description Price
18247C4 -------- $85.89 A18247C4 ------- $76.32
18367C4 -------- $97.37 A18367C4 ------- $82.55
I got the headers to work with this code:
...
foreach ( $cats AS $cat ) {
echo '<th align="center">Item ID</th>';
echo '<th align="center">Description<br />';
echo '<font size="-1">(Click for more info)</font></th>';
echo '<th align="center">Price Each</th>';
echo '<th align="center">Purchase</th>';
}
echo '</tr><tr>';
...
(I don't need to show the category #'s in the header fields) but I
can't get the rest of the data to flow like I want it.
Thanks,
Frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php