Copy link to clipboard
Copied
I have all the products selected from the DB
$maxRows_Recordset1 = 56;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
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);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
but i have a category ID 21 that i dont want showing in with all the other products
what do i have to do
thanks in advance
Jon, this is just basic SQL.
If you wanted to include only rows from that category, you would do:
SELECT * FROM beauProd WHERE categoryID = 21 ORDER BY name ASC";
What do you think you need to change in the WHERE clause so that it excludes categoryID 21?
Copy link to clipboard
Copied
If category is a column in the beauProd table, then just exclude it in the WHERE clause.
Copy link to clipboard
Copied
thought the where clause was to include not exclude?
Copy link to clipboard
Copied
Of course not. You can combine conditions in the WHERE clause to filter IN or filter OUT any values you like.
Copy link to clipboard
Copied
ok thank you. i will have a look on the net to see how to filter out.
thanks again
Copy link to clipboard
Copied
Jon, this is just basic SQL.
If you wanted to include only rows from that category, you would do:
SELECT * FROM beauProd WHERE categoryID = 21 ORDER BY name ASC";
What do you think you need to change in the WHERE clause so that it excludes categoryID 21?
Copy link to clipboard
Copied
SELECT * FROM beauProd WHERE categoryID ! = 21 ORDER BY name ASC";
Copy link to clipboard
Copied
or
SELECT * FROM beauProd WHERE categoryID <> 21 ORDER BY name ASC";
i am going to try both of these
Copy link to clipboard
Copied
SELECT * FROM beauProd WHERE categoryID ! = 21 ORDER BY name ASC";
worked
thanks for you help
Copy link to clipboard
Copied
Good job. The "!=" and "<>" are equivalent MySQL comparison operators, so both should work.
Copy link to clipboard
Copied
thanks for you help and point in the right direction. Bit of investigation and found it.
thanks again
Find more inspiration, events, and resources on the new Adobe Community
Explore Now