1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| if ($choice == 'rand') {
$products_new_sort_order = 'rand() ';
} elseif (choice == 'ASC') {
$products_new_sort_order = 'p.products_sort_order ASC ';
} elseif (choice == 'DESC') {
$products_new_sort_order = 'p.products_sort_order DESC ';
} elseif (choice == 'DATE') {
$products_new_sort_order = 'p.products_sort_order products_date_added ';
} else {
$products_new_sort_order = 'p.products_date_added DESC ';
}
$Qproduct = $OSCOM_PDO->prepare('select distinct p.products_id
from :table_products p left join specials s on p.products_id = s.products_id
where products_status = :products_status
and products_view = :products_view
and p.products_archive = :products_archive
order by :products_sort_order
limit :products_limit
');
$Qproduct->bindInt(':products_status', 1);
$Qproduct->bindInt(':products_view', 1);
$Qproduct->bindInt(':products_archive', 0);
$Qproduct->bindValue(':products_sort_order', $products_new_sort_order);
$Qproduct->bindInt(':products_limit', 10);
$Qproduct->execute();
if ($Qproduct->rowCount() > 0 ) {
........
while ($products = $Qproduct->fetch() ) {
........
}
} |
Partager