This is whole main() function.. I'm sure you didn't need all this but I wasn't sure what to send without possibly leaving out something important.. So here it is:
function main( $category = "" ) { global $database, $PHP_SELF, $settings, $secure, $PHPSESSID, $items, $cartId; $inventory = $database->result( "SELECT * FROM inventory WHERE cartId='$cartId'" ); //Get all the products $products = $database->query( "SELECT * FROM products WHERE cartId='$cartId' AND category=\"$category\" AND status='checked' ORDER BY idNumber, headline, price" ); $category = stripslashes( $category ); if( $category ) echo( "<b>$category</b><br>\n" ); //only display the product links if you are viewing a category or there is products //that aren't in a category if( $category or $database->numRows( $products ) ) { echo( "<div align=right>\n" ); if( sizeof( $items ) ) echo( "<a href=\"$PHP_SELF?command=viewCart\"><font color=\"$settings[link]\">View Cart</font></a>\n" ); if( sizeof( $items ) ) echo( " | " ); if( sizeof( $items ) ) echo( "<a href=\"$PHP_SELF?command=checkOut&PHPSESSID=$PHPSESSID\"><font color=\"$settings[link]\">Check Out</font></a>\n" ); if( sizeof( $items ) and $category != "" ) echo( " | " ); if( $category != "" ) echo( "<a href=\"$PHP_SELF?command=viewCategory\">Back</a>\n" ); echo( " </div>\n" ); } //begin nested tables echo( "<table border=0 cellpadding=0 cellspacing=0 bgcolor=\"$settings[borderColor]\" width=\"100%\"><tr><td>\n" ); echo( "<table border=0 cellpadding=2 cellspacing=\"$settings[border]\" bgcolor=\"$settings[bgColor]\" width=\"100%\">\n" ); if( $category or $database->numRows( $products ) ) { //only display the product headings if you are viewing a category or there is products //that aren't in a category echo( "<tr bgcolor=\"$settings[title]\"><td><b>ID</b></td><td><b>Headline</b></td><td>< b>Price</b></td><td><b>Qty Discounts</b></td><td><b>QuickAdd</b></td></tr>\n" ); } if( $category ) { //if you are viewing a category with no products in it if( !$database->numRows( $products ) ) echo( "<tr><td colspan=3 align=center>There are no products in this category</td></tr>\n" ); } $count = 0; //for alternating row colors while( $product = $database->fetchArray( $products ) ) { $bgColor = $settings['bgColor']; if( $count % 2 ) $bgColor = $settings['oddColor']; $img = ""; if( $product[thumbnail] and $product[thumbnail] != "none" ) { $img = "<a href=\"$PHP_SELF?command=viewProduct&product=$product[idNumber]\"><img border=0 src=\"productImages/$product[thumbnail]\"></a>\n"; } $font = "<font color=\"$settings[font]\">"; $link = "<a href=\"$PHP_SELF?command=viewProduct&product=$product[idNumber]\"><font color=\"$settings[link]\">\n"; echo( "<tr bgcolor=\"$bgColor\"><td width=\"2%\" nowrap valign=top>$link$product[idNumber]<br>$img</font></a></td>\n" ); echo( "<td valign=top>$link$product[headline]</font></a></td>\n" ); echo( "<td width=\"2%\" nowrap align=right valign=top>$font\$" . sprintf( "%.2f", $product[price] ) . "</font></td>\n" ); echo( "<form method=post action=\"$PHP_SELF?command=addToCart&product=$product[idNumber]\">\n" ); if( $inventory->trackInventory and !$inventory->allowOrder and ( $product[inventory] <= 0 or (string)$product[inventory] == "out" ) and (string)$product[inventory] != "exclude" ) { $buttonType = "button"; $warning = "onClick=\"alert( 'Inventory is out on this product. Please try back later.' );\""; } else { $buttonType = "submit"; } if( $product[discOneQty] and $product[discOneQty] != 0 ) echo "<td width=\"8%\" align=right valign=top nowrap>$product[discOneQty]+ @ \$" . sprintf( "%.2f", $product[discOnePrice] ) . " ea<br>\n"; else echo "<td> \n"; if( $product[discTwoQty] and $product[discTwoQty] != 0 ) echo "$product[discTwoQty]+ @ \$" . sprintf( "%.2f", $product[discTwoPrice] ) . " ea</td>\n"; else echo "</td>\n"; echo( "<td width=\"8%\" nowrap align=right valign=bottom><input type=text name=quantity value=1 size=2 style=\"font-size: 8px;\"> <input type=$buttonType $warning value=\"Add To Cart\" style=\"font-family: veranda, arial, sans-serif; font-size: 8pxl\"></td></form></tr>\n" ); $count ++; } if( !$category ) displayCategories( $settings ); echo( "</table></tr></td></table><br>\n" ); if( $settings[returnLink] ) { print "<a href=\"$settings[returnLink]\">$settings[returnLinkName]</a>\n"; } echo( "<br><br>$settings[textAfter]</td></tr></table>\n" ); printPage(); } Hopefully this helps.. Let me know if you have any questions about it.. Later, Bob Weaver "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Bob, > > That would be just about what I am looking for. > > And I wouldn't mind seeing the code you have. > > Thanks > Jennifer > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Are you talking about something that will display a list of products like > > this page: > > > > > http://survivalherbs.com:8080/order/index.php?command=viewCategory&category= > > Herbal+Remedies > > > > These are all gathered from the database with one SELECT statement then > put > > together in the table with a while loop.. Is that what you're talking > about? > > If so, I have the code for it. I wrote the cart that is hosted on that > page > > and can post some code from it if you would like.. > > > > Thanks, > > > > Bob Weaver > > > > "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Hi all, > > > > > > You are probably getting tired of me asking questions but I have another > > and > > > will try to keep them down from now on. > > > > > > If I have let's say five items with different id's, image's and so forth > > how > > > do I display all items on one page. Do I have to use multiple selects > > > or is there another easier way? > > > > > > Also what if I have 5 items that I can buy with id's > > > 1, 2, 3, 4 and 5 and lets say that I bought items 2 and 5 but not 1, 3 > and > > 4 > > > how do I display 2 and 5 but let's say I don't know the id's. > > > > > > I used > > > > > > $id = $HTTP_GET_VARS["id"] > > > > > > > > > to buy them and have tried to use it to display them but I have to know > > the > > > id's in order to make it work with multiple selects. > > > > > > Am I being making sense here? Kinda doesn't make sense to me and I know > > what > > > I am trying to say but I don't think it worked. > > > > > > A good tutorial or help would be appreciated. > > > > > > Thanks > > > Jennifer > > > > > > > > > --- > > > Outgoing mail is certified Virus Free. > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 > > > > > > > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php