Re: Random pick
| From: | Karl DeSaulniers | Date: | Mon, 25 Jan 2010 19:39:24 +0000 |
| Subject: | Re: Random pick | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46797@lists.php.net to get a copy of this message | ||
Hi,
$req_user_level is a MySql return result and I am trying to utilize shortened code to evaluate whither $req_user_level == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9, if it matches a number, return the text associated with that number.
"Guest" || "Regular User" || "Intl. User" || "Contractor" || "Employee" || "Sales" || "Investor" || "Human Resources" || "Administrator";
Karl
On Jan 25, 2010, at 1:31 PM, Olavi Ivask wrote:
Hi, did you mean something like this? $level_names = array("Guest", "Regular User", "Intl. User", "Contractor", "Employee", "Sales", "Investor", "Human Resources", "Administrator"); $user_level = $level_names[$req_user_level]; Regards, Olavi Ivask On Jan 25, 2010, at 9:13 PM, Karl DeSaulniers wrote:Karl DeSaulniers Design Drumm http://designdrumm.comHello List, Trying to learn the right way to code this line. Can anyone tell me if I am doing this the right way? if $req_user_level == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 ? "Guest" || "Regular User" || "Intl. User" || "Contractor" || "Employee" || "Sales" || "Investor" || "Human Resources" || "Administrator"; I am wanting to stray from the if(foo == bar) { routine. ;) Thanks, Karl DeSaulniers Design Drumm http://designdrumm.com