This topic is locked
[SOLVED]

  Before SQL Query

10/25/2013 6:38:00 PM
PHPRunner General questions
S
stiven author

Hello, I am having trouble with a code before SQL Query. the list page is supposed to display only records of the person logged in, but I want to allowed 2 user to see everything without filters. The code works only if I do one user int he if statement but if I do two it doesn't work. I cant think of what I am doing wrong here. I know for sure the $usid equals 435.
Thanks for your help


$usid = $_SESSION['USER_ID_NUM'];
if($usid != 445 || $usid != 435){

$co_id = $_SESSION['COID'];

$strWhereClause = whereAdd($strWhereClause,"service_coordinator = '".$co_id."'");

//echo $strWhereClause;

}
C
cgphp 10/25/2013

Some tweaks:



$usid = $_SESSION['USER_ID_NUM'];
if($usid != 445 && $usid != 435){ //here you need an AND not OR



$co_id = $_SESSION['COID'];



//if co_id is an int use the following statement

$strWhereClause = whereAdd($strWhereClause,"service_coordinator = ".$co_id);



//otherwise, if a string, use this one

$strWhereClause = whereAdd($strWhereClause,"service_coordinator = '".$co_id."'");

}
S
stiven author 10/25/2013



Some tweaks:



$usid = $_SESSION['USER_ID_NUM'];
if($usid != 445 && $usid != 435){ //here you need an AND not OR
$co_id = $_SESSION['COID'];
//if co_id is an int use the following statement

$strWhereClause = whereAdd($strWhereClause,"service_coordinator = ".$co_id);
//otherwise, if a string, use this one

$strWhereClause = whereAdd($strWhereClause,"service_coordinator = '".$co_id."'");

}



Thanks for your help. That worked.