Ciao, devo estrarre una serie di campi da una query e sistemarli in array che poi vado a richiamare su un ciclo for che compone un form:
$q = "SELECT id, dataimm FROM $tabella WHERE idiscrizioni = '$_GET[id]' ORDER BY id ASC";
$r = mysql_query($q, $db) or die (mysql_error());
$z = '0';
while ($a = mysql_fetch_array($r))
{
$id[$z] = $a[id];
$di[$z] = explode("-",$a[dataimm]);
$z ++;
}
si noti l'ultimo campo (data) dataimm del quale devo estarpolare mese ed anno con explode.
poi compongo il form:
for($i = 0; $i < '5'; $i++)
{
$m = $i + 1;
?>
<table cellpadding="5" cellspacing="0" border="0" width="500">
<input type="hidden" name="id[]" value="<?php echo"$id[$i]"; ?>">
<tr><td class="t12">Data Imm. Mese <input class="fr" type="text" name="immese[]" size="2" value="<?php echo"$di[$i][1]"; ?>" maxlength="2"> Anno <input class="fr" type="text" name="imanno[]" size="2" value="<?php echo"$di[$i][0]"; ?>" maxlength="4"></td></tr>
<tr><td class="t12">Intestata a <input class="fr" type="text" name="intestata[]" size="40" value="<?php echo"$intestata[$i]"; ?>" onchange="this.value=this.value.toUpperCase();"></td></tr>
</table>
<?php
}
?>
Ma mi stampa solo array... come posso fare?