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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
//connection.php à ma bdd
<?php require_once('connection.php'); ?>
//pour obtenir les variables de l'url
<?php
$ID_Rub = isset($_GET['menu']) ? mysql_real_escape_string($_GET['menu']) : '';
$ID_Srub = isset($_GET['rubrique']) ? mysql_real_escape_string($_GET['rubrique']) : '';
?>
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_rs_Pdt = 1;
$pageNum_rs_Pdt = 0;
if (isset($_GET['pageNum_rs_Pdt'])) {
$pageNum_rs_Pdt = $_GET['pageNum_rs_Pdt'];
}
$startRow_rs_Pdt = $pageNum_rs_Pdt * $maxRows_rs_Pdt;
// et là je commence à patauger... ci-dessous la dernière tentative mise en place :
mysql_select_db($database_web, $web);
if ((isset($_GET['menu']) && $_GET['menu']!=NULL) && (isset($_GET['rubrique']) && $_GET['rubrique']!=NULL)){
// si menu et rubrique ne sont pas vides
$_req1;
//si non par défaut ID_Rub=1 et ID_Srub=0
} else {
$_req2;
}
//requête selon $var dans url
$_req1 = $query_rs_Pdt("SELECT pdt.`Ref`, pdt.Int_Prod, pdt.Descr, pdt.ID_Rub, pdt.picto, pdt.ID_Srub, pdt.V1, pdt.V2, pdt.V3, pdt.Z1, pdt.Z2, pdt.Z3, rub.Int_Rub, srub.Int_Srub FROM pdt LEFT JOIN rub ON rub.ID_Rub = pdt.ID_Rub LEFT JOIN srub ON srub.ID_Srub = pdt.ID_Srub WHERE pdt.ID_Rub ='".mysql_real_escape_string($_GET['ID_Rub'])."' AND pdt.ID_Srub ='".mysql_real_escape_string($_GET['ID_Srub'])."'");
//si pas de $var dans url, requête par défaut
$_req2 = $query_rs_Pdt("SELECT pdt.`Ref`, pdt.Int_Prod, pdt.Descr, pdt.ID_Rub, pdt.picto, pdt.ID_Srub, pdt.V1, pdt.V2, pdt.V3, pdt.Z1, pdt.Z2, pdt.Z3, rub.Int_Rub, srub.Int_Srub FROM pdt LEFT JOIN rub ON rub.ID_Rub = pdt.ID_Rub LEFT JOIN srub ON srub.ID_Srub = pdt.ID_Srub WHERE pdt.ID_Rub = 1 AND pdt.ID_Srub = 2");
$query_limit_rs_Pdt = sprintf("%s LIMIT %d, %d", $query_rs_Pdt, $startRow_rs_Pdt, $maxRows_rs_Pdt);
$rs_Pdt = mysql_query($query_limit_rs_Pdt, $web) or die(mysql_error());
$row_rs_Pdt = mysql_fetch_assoc($rs_Pdt);
// ensuite il y a mes <div> contenant des echo tels que :
//<?php echo $row_rs_Pdt['Z1']; ?>
<?php mysql_free_result($rs_Pdt);?> |
Partager