Re: Variable just not Behaving Itself.
| From: | Robby Russell | Date: | Tue, 10 Aug 2004 23:57:25 +0000 |
| Subject: | Re: Variable just not Behaving Itself. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193416@lists.php.net to get a copy of this message | ||
On Tue, 2004-08-10 at 16:36, Harlequin wrote:
> I have the following:
>
> [SNIP]
> ...
> $Emp_Status_Rqmt=$row["Emp_Status_Rqmt"];
> }
> if( $Emp_Status_Rqmt == 'Permanent' )
> {
> $UserStatus = 'Permanent';
> }
> if( $Emp_Status_Rqmt == 'Contractor' )
> {
> $UserStatus = 'Contractor';
> }
> else
> {
> $UserStatus == 'Flexible';
> }
> [SNIP]
>
> which echoes OK until I change the value to something other than Permanent
> or Contractor. It simple echoes resource ID #n
>
> what's wrong with me...? the code I mean...?
You can build a bunch of if statements or your switch()...and I'm not
sure why you would keep creating variables with the same value. ;-)
Example:
$Emp_Status_Rqmt = $row["Emp_Status_Rqmt"];
switch ($Emp_Status_Rqmt) {
case "Permanent":
$UserStatus = "Permanent";
break;
case "Contractor":
$UserStatus = "Contractor";
break;
default:
$UserStatus = "Flexible";
}
-Robby
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby@planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc