tjyoung
asked on
Can't find what is wrong with my syntax using an if statement in a query
Can someone see what is wrong with my syntax (it may be completely obvious or for some reason impossible to do. I'm not particularly good at this)
I'm trying to say more or less:
if the Session variable: switch_user_id has a value, use it, otherwise use the session variable user_id value instead. Below is part of a constructed query using datatables.net.
I am using session_start(); at the top of my page.
Get this error in my logs:
PHP Parse error: syntax error, unexpected T_IF
I'm trying to say more or less:
if the Session variable: switch_user_id has a value, use it, otherwise use the session variable user_id value instead. Below is part of a constructed query using datatables.net.
$sWhere .= " AND subscribers.account_id=".
if (isset($_SESSION['switch_user_id']))
{
$_SESSION['switch_user_id'];
} else {
$_SESSION['user_id'];
};
I am using session_start(); at the top of my page.
Get this error in my logs:
PHP Parse error: syntax error, unexpected T_IF
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER