Re: If conditional behaviour

From: Date: Tue, 19 Nov 2002 03:39:59 +0000
Subject: Re: If conditional behaviour
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-23468@lists.php.net to get a copy of this message
If you develop the habit of writing conditionals like this: if ("Victoria" == $city) instead of like this: if ($city == "Victoria") Your compiler (interpreter in PHP's case) will catch the assignment vs. comparison error for you, because assigning to $city is valid but assigning to a constant string "Victoria" isn't. Of course you'd have to have display_errors On for PHP to report the problem.... Evan At 9:17 PM -0800 on 2002.11.15, Bradley Crockett wrote about "Re: [PHP-DB] If conditional behaviour":
That was it. How embarrassing. Thanks! On Fri, 15 Nov 2002 21:12:42 -0800 (PST), Mihail Bota wrote:
Did you try $city=="Victoria" ? On Fri, 15 Nov 2002, Bradley Crockett wrote:
AT http://crockett.ca/joinoptional.php I have a page posted. PHP isn't set up on the server, so I've posted a screenshot of what it looks like at http://crockett.ca/joinoptionalrendered.bmp (1/2 MB, sorry). For some reason, it wants to repeat 'Victoria' in the form. If I comment out the If conditional: ÝÝÝÝ// if ($city = "Victoria") { ÝÝÝÝ// Ýecho "selected "; ÝÝÝÝ// } ..the problem goes away and the different cities appear as expected. The result of the query is at http://crockett.ca/queryresults.txt Can someone point me in the right direction? Brad Crockett Duncan BC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- "The Engine of Mischief" <http://www.enginesofmischief.com/engine> 1976 GMC Eleganza II TZE166V100089 I do whatever the voices tell me to do.

« previous php.db (#23468) next »