Display all rows except where a colomb = 5 !
Question:
I have a colomb called Block in a table called amigos
When i block someone, i give the colomb Block a value of 5
Now, i want to retreive data...
How can i display all rows from the table amigos where Block DOES NOT equal to 5
I dont know how to write my q!
can you show me what to make q
Answers:
You can use <> operator to check this
So your query will be something like:
Let us say if you want to check more than one value, you can use NOT IN clause.
Example
_________________
I have a colomb called Block in a table called amigos
When i block someone, i give the colomb Block a value of 5
Now, i want to retreive data...
How can i display all rows from the table amigos where Block DOES NOT equal to 5
I dont know how to write my q!
| Code: |
| $con=mysql_connect("localhost", "name", "password");
mysql_select_db("database",$con); $q = "SELECT * FROM amigos ORDER BY Date DESC, Time DESC LIMIT 0, 20;"; $res = @mysql_query($q,$con); |
can you show me what to make q
Answers:
You can use <> operator to check this
So your query will be something like:
| Code: |
| $q = "SELECT * FROM amigos WHERE Block<> 5 ORDER BY Date DESC, Time DESC LIMIT 0, 20;";
$res = @mysql_query($q,$con); |
Let us say if you want to check more than one value, you can use NOT IN clause.
Example
| Code: |
| $q = "SELECT * FROM amigos WHERE Block NOT IN(3,,4,5)ORDER BY Date DESC, Time DESC LIMIT 0, 20;"; |
_________________
Commentaires
Enregistrer un commentaire