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 ) { } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php