stewart715 Posted October 31, 2006 Share Posted October 31, 2006 is it possible to have more than 1 if statement in an if..for example[code]<?php$row=certain number from sql query if ($row == 2){ return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields));} else if ($row == 1){ if (@in_array($user->uid, array_keys(buddylist_get_buddies($account->uid))) && user_access('maintain buddy list')) { return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields)); } else if ($account->uid != $user->uid && user_access('maintain buddy list')) { return _phptemplate_callback('private_profile', array('user' => $user, 'fields' => $fields)); } } else if ($row == NULL){ return _phptemplate_callback('private_profile', array('user' => $user, 'fields' => $fields));} else {print 'Privacy mode error';} }?>[/code[[/code] Link to comment https://forums.phpfreaks.com/topic/25722-mulitiple-ifs-in-one-if-statement/ Share on other sites More sharing options...
scliburn Posted October 31, 2006 Share Posted October 31, 2006 yes of course. inside a conditional statement, you can have other conditional statements.You can also consider using the "switch" statement for your initial conditional statement. Link to comment https://forums.phpfreaks.com/topic/25722-mulitiple-ifs-in-one-if-statement/#findComment-117412 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.