Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/64925-bypassing-a-failed-query/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.