envexlabs Posted August 14, 2007 Share Posted August 14, 2007 Hey, I have this function that checks a couple of things function no_store($store_id){ $store_check_mem_id = $_SESSION['_amember_user']; $check_store_query = mysql_query('SELECT * FROM `store` WHERE `store_id` = ' . $store_check_mem_id[member_id] . ''); $store_exist_query = mysql_query('SELECT * FROM `store` WHERE `store_id` = ' . $store_id . ''); //STEP ONE //if the store doesn't exist it boots the user to the index page if(mysql_num_rows($store_exist_query) > 0) { //STEP TWO //checks if the $_GET[store_id] as been deleted or left blank if ($_GET[store_id] == "") { //boots user header('Location: http://www.werehavingasale.com/index.php'); }else{ if(mysql_num_rows($check_store_query) > 0) { //everything is good and the user can go about his business }else{ //STEP 3 //if the logged in user has not created a store, it sends them to create one header('Location: http://www.werehavingasale.com/createstore.php'); } } }else{ //boots user header('Location: http://www.werehavingasale.com/index.php'); } } The problem i am having is with the $check_store_query It will only work if a user is logged in, but i need it to work both ways. Is there a way i can tell mySQL or PHP to skip it if it fails? Thanks, envex Quote Link to comment Share on other sites More sharing options...
fenway Posted August 20, 2007 Share Posted August 20, 2007 I don't know what you mean by fail, you mean no rows returned? Check mysql_num_rows(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.