Page 1 of 1

how to exclude a category in where clause

Posted: Fri Sep 28, 2012 1:52 am
by jonnyfortis
I have a query

mysql_select_db($database_beau, $beau);
$query_Recordset1 = "SELECT * FROM beauProd ORDER BY name ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $beau) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

but need to add a where clause to exclude a catID = 21 rather than include

any pointers

thanks

Re: how to exclude a category in where clause

Posted: Fri Sep 28, 2012 5:42 am
by Celauran

Code: Select all

SELECT column1, column2, column3
FROM beauProd
WHERE catID != 21
ORDER BY name ASC
LIMIT foo, bar

Re: how to exclude a category in where clause

Posted: Fri Sep 28, 2012 7:32 am
by jonnyfortis
thats great

thanks so much for your help