1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
$affichage_produits = $bdd->prepare('SELECT P.id, P.nom_onglet_pro, P.nom_rubrique_pro, P.nom_sous_rub_pro, P.nom_monture, P.tarif, P.stock, M.num_monture, I.num_monture, I.nom_img_monture, I.odr_aff_img FROM produits
AS P INNER JOIN images_monture AS M ON P.id = M.num_monture
LEFT JOIN (SELECT num_monture, MIN( odr_aff_img ) AS img FROM images_monture GROUP BY num_monture)
AS MI ON P.id = MI.num_monture
LEFT JOIN images_monture AS I ON P.id = I.num_monture AND MI.img = I.odr_aff_img
WHERE P.lien_onglet_pro = :lien_page AND P.lien_rub_prod = :lien_rub AND P.lien_sous_rub_pro = :lien_sous_rub GROUP BY I.num_monture
ORDER BY P.nom_monture ASC');
$affichage_produits->bindValue('lien_page', $page, PDO::PARAM_STR);
$affichage_produits->bindValue('lien_rub', $choix_decode, PDO::PARAM_STR);
$affichage_produits->bindValue('lien_sous_rub', $action_decode, PDO::PARAM_STR);
try
{
$affichage_produits->execute();
$total_image = $affichage_produits->rowCount();
}
catch (PDOException $e) {
echo 'Error : ' . $e->getMessage();
die();
} |
Partager