IF $id for user is empty or null, then do else if?? HELP
Posted: Thu Apr 07, 2011 11:20 pm
This piece of code works perfect if the user has a $id listed in DB and is returned from the SQL Query that collects the need values, which first follws this piece of code.
However, if the user does not have a $id in that table, it should do the else if, but it goes straight to the last else.
What should the else if($id == ' ') or else if(empty($id == ' '))??
PLEASE HELP..
However, if the user does not have a $id in that table, it should do the else if, but it goes straight to the last else.
What should the else if($id == ' ') or else if(empty($id == ' '))??
PLEASE HELP..
Code: Select all
if ($id) {
if ($user->get('id') == 0 || $userid == 0 || $userid <> $user->get('id')){
//$url = JURI::root() . 'index.php?' . $component . '&id=' . $id . '&tmpl=component&print=1';
$url=JURI::root().'index.php?'.$component.'&id='.$id.'&tmpl=component&print=1';
for($i=1;$i<count($type);$i++){
$url.='&'.$type[$i].'='.$layout[$i];
}
}
} else if($id == ' ') {
$url=JURI::root().'index.php?option=com_muscol&view=album&id=27&tmpl=component&print=1';
for($i=1;$i<count($type);$i++){
$url.='&'.$type[$i].'='.$layout[$i];
}
} else {
echo 'User Album Loading...';
}
}