fifth
04-12-2006, 15:46
Ciao a tutti. ho scritto un pezzo di codice in un file php:
$array=array("a","b","c","d","e");
foreach ($array as $elem){
$number = mysql_query("select id from table where name='$elem'");
$n = mysql_fetch_row($number);
echo"n = $n[0]<br>";
}
Nella tabella che gli passo è presente un identificatore univoco per ogni elemento. Il problema è che funziona per tutti tranne che per il primo!!! E non riesco a capire perchè...
:muro:
$array=array("a","b","c","d","e");
foreach ($array as $elem){
$number = mysql_query("select id from table where name='$elem'");
$n = mysql_fetch_row($number);
echo"n = $n[0]<br>";
}
Nella tabella che gli passo è presente un identificatore univoco per ogni elemento. Il problema è che funziona per tutti tranne che per il primo!!! E non riesco a capire perchè...
:muro: