[PHP-DB] Re: Multiple selects?

2002-04-08 Thread phplists

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( "$category\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( "\n" );
  if( sizeof( $items ) ) echo( "View Cart\n" );
  if( sizeof( $items ) ) echo( " | " );
  if( sizeof( $items ) ) echo( "Check Out\n" );
  if( sizeof( $items ) and $category != "" ) echo( " | " );
  if( $category != "" ) echo( "Back\n" );
  echo( "   \n" );
 }

 //begin nested tables
 echo( "\n" );
 echo( "\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( "IDHeadline<
b>PriceQty
DiscountsQuickAdd\n" );
 }

 if( $category )
 {
  //if you are viewing a category with no products in it
  if( !$database->numRows( $products ) ) echo( "There are no products in this category\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 = "\n";
  }

  $font = "";
  $link = "\n";
  echo( "$link$product[idNumber]$img\n" );
  echo( "$link$product[headline]\n" );
  echo( "$font\$" .
sprintf( "%.2f", $product[price] ) . "\n" );
  echo( "\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 "$product[discOneQty]+ @ \$" .
sprintf( "%.2f", $product[discOnePrice] ) . " ea\n";
   else echo " \n";
  if( $product[discTwoQty] and $product[discTwoQty] != 0 ) echo
"$product[discTwoQty]+ @ \$" . sprintf( "%.2f", $product[discTwoPrice] ) . "
ea\n";
   else echo "\n";
echo( " \n" );
  $count ++;
 }

 if( !$category ) displayCategories( $settings );

 echo( "\n" );

 if( $settings[returnLink] )
 {
  print "$settings[returnLinkName]\n";
 }

 echo( "$settings[textAfter]\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.
> > >
> > 

[PHP-DB] Re: Multiple selects?

2002-04-08 Thread Jennifer Downey

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




[PHP-DB] Re: Multiple selects?

2002-04-08 Thread phplists

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
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php