Shopping cart application question

[email protected] ("Ron Piggott")
Newsgroups php.db
Message-ID <db68c31c775977633c3ff10e85a16ede.squirrel@www.theverseoftheday.info>
I am writing a shopping cart application.  I am expanding the application
to have a store membership component.

Right now I am saving the customers selections in one of two ways:
- In the session variable "$_SESSION['order']" if they aren't logged in
- For those who have logged into their account I am saving their
selections in the table "membership_shopping_carts"

I have ran into trouble trying to output their choices under the "cart
contents" heading.  I want to invoke one of two loops --- A 'while' loop
for the session variable and a mySQL query for the logged in users.

The " } else { " confuses PHP.  I am not sure what I should be doing.

$_SESSION['user_reference'] stores the value of the logged in user.  This
is how I tell if s/he is logged in or not --- and which loop I want to
invoke.

Suggestions?

Ron

if ( $_SESSION['user_reference'] > 0 ) {

$user_reference = $_SESSION['user_reference'];
$query = "SELECT `store_product_profile`.`reference` FROM
`membership_shopping_carts` INNER JOIN `store_product_profile` on
`store_product_profile`.`reference` =
`membership_shopping_carts`.`store_product_profile_reference` WHERE
`membership_shopping_carts`.`member_reference` = $user_reference ORDER BY
`store_product_profile`.`product_name` ASC";
$shopping_cart_content_result=mysql_query($query);
$cart_records_found=mysql_numrows($shopping_cart_content_result);

$i=0;
while ( $i < $cart_records_found ) {

} else {

foreach ($_SESSION['order'] AS $key => $value ) {

}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.