Re: If conditional behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: 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.

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux