j'ai une fonction que je ne comprend pas, elle affiche 3 cellule par 3.
function produitvu() {
$reponse = new xajaxResponse();
$req = "SELECT * FROM produits ORDER BY id";
$query = mysql_query($req);
$txt = '<table width="100%" border="0" cellspacing="5">';
$i=0;
while($tb = mysql_fetch_assoc($query)){
if($i%3 == 0) $txt .= '<tr>';
$txt .= '<td align="center">' . $tb['nom'] . '<br><img width="110" height="161" src="' . $tb['photo'] . '" alt="' . $tb['nom'] . '" OnClick="xajax_detailvu(' . $tb['id'] . ');"><br>' . $tb['prix'] . '</td>';
if(($i+1%3) == 0) $txt .= '</tr>';
$i++;
}
$txt .= '</table>';
$reponse->addAssign("detail", "innerHTML", $txt);
return $reponse->getXML();
}
donc je bloque sur le contrôle
if($i%3 == 0) $txt .= '<tr>';
et
if(($i+1%3) == 0) $txt .= '</tr>';
$i+1%3 sa fait 1 modulo de 3 = 0.33Merci