Jump to content

bypassing a failed query


envexlabs

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.