Ciao,
ho seguito la tue indicazione così:
Codice PHP:
<?php
$qry3="SELECT caratteristiche FROM utenti JOIN caract ON aspetto1 = valori WHERE aspetto1 LIKE '1%' AND id='$_GET[id]' UNION SELECT caratteristiche FROM utenti JOIN caract ON aspetto1 = valori WHERE aspetto2 LIKE '1%' AND id='$_GET[id]'";
$result3 = mysql_query($qry3);
$qry4="SELECT caratteristiche FROM utenti JOIN caract ON aspetto1 = valori WHERE aspetto1 LIKE '2%' AND id='$_GET[id]' UNION SELECT caratteristiche FROM utenti JOIN caract ON aspetto1 = valori WHERE aspetto2 LIKE '2%' AND id='$_GET[id]'";
$result4 = mysql_query($qry4);
$row = array();
$i = 0;
while ($row3 = mysql_fetch_array($result3)) {
$row[$i++][0] = $row3['caratteristiche'];
};
$i = 0;
while ($row4 = mysql_fetch_array($result4)) {
$row[$i++][1] = $row4['caratteristiche'];
};
echo '
<CENTER><table><table border="1" cellpadding="8" cellspacing="5">
<tr>
<td>[b]LIMITI[/b]</td>
<td>[b]POTENZIALITA\'[/b]</td>
</tr>
';
foreach ($row as $cols) {
echo '
<tr>
<td>' . $cols[0] . '</td>
<td>' . $cols[1] . '</td>
</tr>
';
}
echo '</table></CENTER>
';
?>
E vedo valorizzata soltanto la colonna LIMITI.
Il debug di php mi restituisce il seguente errore:
codice:
Notice: Undefined offset: 1 in C:\Users\X\Desktop\mowes_portable\www\test\potenzlimit_solegio.php on line 1112
Dove sbaglio?
Tiziano
[QUOTE]Originariamente inviato da eiyen
non si può così... o fai un ciclo oppure:
Codice PHP:
$row = array();
$i = 0;
while ($row3 = mysql_fetch_array($result3)) {
$row[$i++][0] = $row3['caratteristiche'];
};
$i = 0;
while ($row4 = mysql_fetch_array($resul4)) {
$row[$i++][1] = $row4['caratteristiche'];
};
foreach ($row as $cols) {
echo '
<tr>
<td>' . $cols[0] . '</td>
<td>' . $cols[1] . '</td>
';
};
supponendo le lunghezze coincidano, altrimenti devi aggiungere dei controlli [/QUOTE