Where clause and operators

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Perfidus
Forum Contributor
Posts: 114
Joined: Sun Nov 02, 2003 9:54 pm

Where clause and operators

Post by Perfidus »

Does the != operator work for the WHERE clause in a mysql query?
I'm trying a query like "SELECT FROM $table WHERE Num!=1 AND Num!=2" but it doesn't seem to work...

Any hints?
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

!= works.
There should be "SELECT columns or * FROM tablename ..."
Perfidus
Forum Contributor
Posts: 114
Joined: Sun Nov 02, 2003 9:54 pm

Post by Perfidus »

MarK (CZ) wrote:!= works.
There should be "SELECT columns or * FROM tablename ..."
Yes, it exist!
I have a nice * there!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

btw, you might want to use <> instead of != because that is the standard ;)
peni
Forum Commoner
Posts: 34
Joined: Thu Nov 18, 2004 1:15 pm

Post by peni »

it could be useful to put field names into `these` apostrophes and their values into 'these'.

Code: Select all

SELECT * FROM `$table` WHERE `Num`<>'1' AND `Num`<>'2'
Post Reply