|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP "else" problem
what is wrong with this?
PHP Code:
|
|
#2
|
||||
|
||||
|
put the values into quotes, you're wanting to store them as string values right?
|
|
#3
|
||||
|
||||
|
ok... First off, Im going to show you a few options you have later on when you get into other types of coding, so you can avoid if logic loops, it'll help reduce load on the server (its only a minute bit but still
)you can do the same thing with a case statement: PHP Code:
or.. if you want to go even more advanced, store everything into an array ![]() PHP Code:
not saying you have to do this, but it's an option ... makes for a lot less typing, and I'm lazy.. heheHTH Last edited by nicat23 : August 30th, 2003 at 12:30 PM. |
|
#4
|
|||
|
|||
|
Going with Nicat's suggestion would be best... But the problem with you code is that you have this:
PHP Code:
And it should be: PHP Code:
Using a single "=" means you're assigning the value to your variable, rather than comparing them. You should use == when comparing values. HTH!
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#5
|
||||
|
||||
|
And to elaborate on FrankieShakes's post, using the assignment operator (=) instead of the comparison operator (==) should evaluate to true, and your first if will always be executed.
|
|
#6
|
||||
|
||||
|
Thanks for the correction guys
See... no one's perfect.. hehe |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP "else" problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|