oui en effet j'ai fait un labsus sur table et base, merci de me corrigé
voici tous mon code
<?php require_once('../Connections/toto.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$currentPage = $_SERVER["PHP_SELF"];
session_start();
//test si client déjà identifié
if (!isset($HTTP_SESSION_VARS['INACTIF_CL'])||($HTTP_SESSION_VARS['INACTIF_CL'] != "0"))
{ header("Location:login1.php"); }
if (!isset($HTTP_SESSION_VARS['total'])) $total=0;
else $total=$HTTP_SESSION_VARS['total'];
if (!isset($HTTP_SESSION_VARS['clientID'])) $clientID=0;
else $clientID=$HTTP_SESSION_VARS['clientID'];
switch($case) {
case "1" :
$critereSort = "morceaux";
$critereAdd =$_SESSION['total'];
break;
case "2" :
$critereSort = "categorie";
$critereAdd =$_SESSION['total'];
break;
case "3" :
$critereSort = "reference";
$critereAdd =$_SESSION['total'];
break;
default :
$critereSort = "reference";
$critereAdd = "' '";
break;
}
$colname_Re_promos = "1";
if (isset($_SESSION['clientID'])) {
$colname_Re_promos = (get_magic_quotes_gpc()) ? $_SESSION['clientID'] : addslashes($_SESSION['clientID']);
}
mysql_select_db($database_vivanda, $vivanda);
$query_Re_promos = sprintf("SELECT articles.*,articleclient.* FROM articles INNER JOIN articleclient ON articles.reference AND articleclient.ref_art WHERE articles.categorie = $critereAdd AND articleclient.idclient_art = '%s' GROUP BY articles.reference ORDER BY $critereSort", $colname_Re_promos);
$Re_promos = mysql_query($query_Re_promos, $vivanda) or die(mysql_error());
$row_Re_promos = mysql_fetch_assoc($Re_promos);
$totalRows_Re_promos = mysql_num_rows($Re_promos);
$colname_Recordset1 = "1";
if (isset($_SESSION['clientID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['clientID'] : addslashes($_SESSION['clientID']);
}
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
$queryString_Re_promos = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Re_promos") == false &&
stristr($param, "totalRows_Re_promos") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Re_promos = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Re_promos = sprintf("&totalRows_Re_promos=%d%s", $totalRows_Re_promos, $queryString_Re_promos);
?>
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<title>Afficher produits</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.Style1 {font-size: 12px}
.Style9 {color: #FFFFFF}
.Style10 {
font-size: large;
font-weight: bold;
color: #FF0000;
}
.Style15 {font-size: 12px; color: #000000; }
.Style16 {color: #000000}
-->
</style>
</head>
<body>
<?php if ($totalRows_Re_promos > 0) { // Show if recordset not empty ?>
<?php do { ?>
<?php
$colname1_Recordset1 = ($row_Re_promos['reference']);
mysql_select_db($database_vivanda, $vivanda);
$query_Recordset1 = sprintf("SELECT * FROM articleclient WHERE idclient_art = '%s' AND ref_art = '%s' ORDER BY ref_art ASC", $colname_Recordset1,$colname1_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $vivanda) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<table width="100%" border="1" cellpadding="1" cellspacing="0">
<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
<tr bgcolor="#FFFFCC">
<th width="10%" align="center" scope="col"><span class="Style15"><?php echo $row_Re_promos['reference']; ?> </span></th>
<th width="20%" align="center" scope="col"><span class="Style16"><?php echo $row_Re_promos['morceaux']; ?></span></th>
<th width="15%" align="center" class="Style15" scope="col"><img src="images/<?php echo $row_Re_promos['couleur']; ?>" width="15" height="15"> <?php echo $row_Re_promos['categorie']; ?></th>
<th width="11%" align="center" scope="col"><p class="Style15"><?php echo $row_Re_promos['prixArticle']; ?></p></th>
<th width="10%" align="center" scope="col"><span class="Style15"><?php echo $row_Re_promos['Poids']; ?> </span></th>
<th width="5%" align="top" scope="col"><input name="Ajout" type="checkbox" id="Ajout" onClick="produit_afficher3.php" value="<?php echo $row_Re_promos['reference']; ?>" checked></th>
</tr>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
<tr>
<th width="10%" align="center" scope="col"><span class="Style1"><?php echo $row_Re_promos['reference']; ?> </span></th>
<th width="20%" align="center" scope="col"><?php echo $row_Re_promos['morceaux']; ?></th>
<th width="15%" align="center" class="Style1" scope="col"><img src="images/<?php echo $row_Re_promos['couleur']; ?>" width="15" height="15"> <?php echo $row_Re_promos['categorie']; ?></th>
<th width="11%" align="center" scope="col"><p class="Style1"><?php echo $row_Re_promos['prixArticle']; ?></p> </th>
<th width="10%" align="center" scope="col"><span class="Style1"><?php echo $row_Re_promos['Poids']; ?> </span></th>
<th width="5%" align="top" scope="col"><span class="Style16">
<input name="Ajout" type="checkbox" id="Ajout" onClick="produit_afficher3.php" value="<?php echo $row_Re_promos['reference']; ?>">
</span></th>
</tr>
<?php } // Show if recordset empty ?>
</table>
<?php } while ($row_Re_promos = mysql_fetch_assoc($Re_promos)); ?>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_Re_promos == 0) { // Show if recordset empty ?>
<p align="center" class="Style9 Style10">Choisissez une catégorie </p>
<?php } // Show if recordset empty ?>
</body>
</html>
<?php
mysql_free_result($Re_promos);
//mysql_free_result($Recordset1);
?>
Du coup j'ai modifier mon code j'ai fait la recherche de table article_client dans la boucle article.
et du coup ca marche .
Je pense que mon premiere code je partais dans une mauvaise voix.
donne moi ton avis arnal.
A+
MANUANTIBES
