I have been trying to organize my code better by using functions, 
especially where I am repeating logic.  The problem seems to be when I run 
a condition within the function, an if statement to check for results of a 
variable.  As is the code seems to be bypasses, but if I put a die; in the 
function after the line that was skipped before I get the desired results.

Code sample below is checking a table that lists a userID and if the user 
has ever logged onto the system before:

function chkFirstTime($userID){
 global $connection,$db,$userID;
 $sqlChkFirstTime = "select fk_userID,firstTime from firstTime  where fk_userID = 
'$userID'";
 $resultFirstTime = mssql_query($sqlChkFirstTime, $connection);
 $rowFirstTime = mssql_fetch_array($resultFirstTime);
 $firstTime = $rowFirstTime["firstTime"];
  if ($firstTime == ""){
   include ('includes/incFirstTime.php');
  }
}

If I place a die; after the include it will run, of course it stops other 
users from getting in as well.  

Thanks,

-Scott



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to