Jump to content

how would i combine these if's


cloudll

Recommended Posts

Hi guys, im currently querying my database and if ($row) im including a file. But i would like to make it so if ($row) or a session variable is active, to include the file.

 

I have tried using || but ive only ever used that for regular variables and I cant get it working in the way i want.

 

so at the moment i have

 

if ($row)

(

require 'myfile'; 

 

and i would like to add || $_SESSION['email'] is active. im guessing i would use isset, but i just cannot get it working.

Link to comment
Share on other sites

And please state what the values for $row and $_SESSION['email'] could contain. If you want to do something based upon a session value OR a database result then you should do the Session value check first. If that fails THEN you would do the query. No need to run a query if the session condition is true.

Link to comment
Share on other sites

the value of $row is a post from a form. an email address to check if that email has already been used in the database.

 

and session email doesnt contain anything, it just needs to exist for the require to kick in.

 

Still not clear. Is $row the value from the form or is it the result from the DB query? Would be nice to see some code.

 

But, based upon my previous statemetn I'd be doing something like this:

$includeFile = isset($_SESSION['email']);
if(!$includeFile)
{
    //Use form input to run db query and set 
    //$includeFile as appropriate
}

if($includeFile)
{
    require 'myfile';
}

Link to comment
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.