hey. is there a way to perform a mysql query if you want all the results EXCEPT for rows with specific ids?
ex. I want all the clubs except for the club where id=“3”
??
hey. is there a way to perform a mysql query if you want all the results EXCEPT for rows with specific ids?
ex. I want all the clubs except for the club where id=“3”
??
WHERE id != 3
Also you said “ids” in your first sentence… so you have have a bunch, format them like so:
$idList : 3,6,2,9,22,44,…
then WHERE id NOT IN ($idList)
$sql = "SELECT * FROM clubs where ID != `3`";
$res = mysql_query($sql)or die("Error: " . mysql_error());
The MySQL “not equal to” operaters are != and <>
ok, just to make it easier. You use exactly the same script, but you put a ! before the = sign.
e.g. the original
if ($variable == “name”)
e.g. after
if ($variable != “name”)
you can use it to reverse most commands