cloudll Posted January 20, 2012 Share Posted January 20, 2012 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. Quote Link to comment Share on other sites More sharing options...
SergeiSS Posted January 20, 2012 Share Posted January 20, 2012 im guessing i would use isset, but i just cannot get it working. You'd better show that code. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 20, 2012 Share Posted January 20, 2012 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. Quote Link to comment Share on other sites More sharing options...
cloudll Posted January 20, 2012 Author Share Posted January 20, 2012 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. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 20, 2012 Share Posted January 20, 2012 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'; } 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.