On Sat, 2003-11-22 at 13:57, Pieter wrote:
> I recently started coding online and i have the weirdest response, my code is: 
> 
> <?php
> 
> include 'function.inc';
> 
> echo "$id<br>";
> 
> print (gettype($id));
> 
> if ($id = "add" )
> 
> {
> 
> echo "is add";
> 
> exit;
> 
> }
> 
> 
> if ($id = "own" )
> 
> {
> 
> 
> echo "id is own";
> 
> exit;
> 
> }
> 
> if ($id = "all" )
> 
> {
> 
> 
> echo "id is all";
> 
> exit;
> 
> }
> 
> ?>
> 
> $id in this case  = "own", but it totally ignores this value and uses the first if 
> statement and treats $id as if it has a value of "add". I am very frustrated and i 
> really hope someone can help me. The server is linux, and php version 4.1.2
> 
> Thanks
> 

Don't use = use ==
By using the = you are assigning $id to that value making the if
statement always true. 

The compare one to the other use == instead
-- 
"I have a photographic memory. I just forgot the film" --Unknown
=============================
Ryan Thompson
[EMAIL PROTECTED]
http://osgw.sourceforge.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to