Comparing Memory Variables
| From: | RealGM Webmaster | Date: | Sat, 13 Jan 2001 08:41:20 +0000 |
| Subject: | Comparing Memory Variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34353@lists.php.net to get a copy of this message | ||
Hi Everyone,
I am having a little trouble getting a memory variable and a session variable to compare correctly
I have an if statement as below:
if ($id=='{$SESSION["id"]}') {
echo "working";
}
ID is a memory variable that is equal to five, and the session variable id is also equal to five.
When I do through the check again $id is set to be the characters {$SESSION["id"]} rather
than the five that it was previously assigned to.
Basically what it is doing is assigning the characters proceeding the = sign to the variable $id
rather than doing the comparison.
Does anyone know how I can get around this. I tried two = signs and the working message does not
display, but one = sign displays the message but does it also changes the value of $id.
Has anyone got any idea how I can get around this problem?
Thanks,
Michael.