Computing.Net > Forums > Web Development > != operator is not working

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

!= operator is not working

Reply to Message Icon

Name: BigShow
Date: September 21, 2009 at 11:18:57 Pacific
OS: Windows XP
CPU/Ram: pentium 4
Product: Dell / Lap top
Subcategory: PHP
Comment:

Thi shouldn't be that tough. I have two numbers coming out of a db, i put them into variables then try and run an if statement..

if ($a != $b) { show this; }

its not working. the show this always shows. Why would that operator not work. And it seems like it just happened because it was working fine for the past XX amount of years. Thoughts?



Sponsored Link
Ads by Google

Response Number 1
Name: shutat
Date: September 21, 2009 at 12:58:48 Pacific
Reply:

php is a "loose" language and *may* be comparing strings to ints or other types as it stores data from the db. If the data being assigned is valid, then what you might try is the settype function.

settype($a, "integer");
settype($b, "integer");

if($a != $b) { show this; }


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: != operator is not working

php Guestbook not working properly www.computing.net/answers/webdevel/php-guestbook-not-working-properly/719.html

prevent hotlinking code not working www.computing.net/answers/webdevel/prevent-hotlinking-code-not-working/3117.html

Links not working www.computing.net/answers/webdevel/links-not-working/4012.html