[Tableaux] PHP, Array et réaffichage
Bonjour,
J'ai un probleme avec les tableaux. je remplie mon tableau et quand je veux reafficher le contenu, il ne m affiche que la derniere valeur du tableau. Voila la declaration :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?
$req4 = "select emplacement, commande_web.id_cmd
from type_pdt_web, produit_web, pdt_rub, commande_web
where type_pdt_web like '%invite%'
and type_pdt_web.id_type_pdt = $produit
and produit_web.id_type_pdt = type_pdt_web.id_type_pdt
and produit_web.id_produit_web = pdt_rub.id_pdt
and pdt_rub.id_sup = $support
and commande_web.id_cmd = pdt_rub.id_cmd
and date_fc >= '$date%'
group by emplacement";
$res4 = mysql_query($req4);
for($i=0;$i<$nbr3;$i++)
{
while($row4 = mysql_fetch_assoc($res4))
{
$tab[$i][1] = $row4["emplacement"];
$tab[$i][2] = $row4["id_cmd"];
}
}
}
?> |
Et voila ou je veux mettre les valeurs du tableau
Code:
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
| <table width="90%" border=1 cellspacing=0 bordercolor="#AODOFF" bgcolor="white" align="center">
<tr>
<?
for($i=1;$i<$nbr3;$i++)
{
for($j=1;$j<6;$j++)
{
?>
<td width="20%"> <?
if($tab[$i][1]==$j)
{
$cmd = $tab[$i][2];
$req4 = "select *
from commande_web, societe
where id_cmd = $cmd
and commande_web.code_soc = societe.code_soc";
$res4 = mysql_query($req4);
$row4 = mysql_fetch_assoc($res4);
echo "<ins>Emplacement N°:</ins> <strong>".$tab[$i][1]."</strong><br> ".$row4["soc_org"]."<br> ".preg_replace('/^(.{4})-(.{2})-(.{2})$/','$3-$2-$1', $row4['date_fc']);
}
?></td><?
}
?>
</tr>
...</tableau> |
Pouvez vous me dire comment regler ce probleme
Citation:
Notice: Undefined offset: 2 in c:\program files\easyphp1-8\www\hybride\date_verif.php on line 135
Alors que j'ai 2 lignes à inserer dans le tableau :roll:
Merci d'avance pour vos reponses.