- Home
- Categorie
- Coding e Sistemistica
- Coding
- Errore strano
-
Errore strano
Salve a tutti
In questo script alla linea
[PHP]
$foto[]=$row['foto'];
[/PHP]
Ricevo questo errore
Fatal error: [] operator not supported for strings in /web/htdocs/miosito/home/pagina.php on line 200Questo è lo script intero
[PHP]
<?//seleziono i campi da visualizzare per singolo utente
$strsqlultima="SELECT id,cognome,nome,foto FROM iscritti ORDER BY id DESC ";
$query1=mysql_query("$strsqlultima") or die("Errore query database: " . mysql_error());while($row=mysql_fetch_array($query1))
{
$foto[]=$row['foto'];
$nome[]=$row['nome'];
$cognome[]=$row['cognome'];
}
$num_rows=ceil(count($nome)/3);
$table="<table width='162'border='1'>";
$a=0;for($i=0;$i<$num_rows;$i++)
{$table.="<tr>"; for($k=0;$k<3;$k++) { $a++; $table.="<td width='33%' > <img src=\"immagini/".$foto[$a-1]."\" width=\"45\" height=\"50\" border=\"0\"/><center><font class='fontprofilo'>".$nome[$a-1]." ".$cognome[$a-1]."</center></td></font> </td>"; }$table.="</tr>";
}$table.="</table>";
echo $table;
?>[/PHP]
Come posso risolvere questo errore?
-
Ciao carlitos1982,
prova a mettere:
[php]
$foto = array();
[/php]
Prima del ciclo.
-
Grande..!Funziona:D
Mille grazie TheDarkita
-
Figurati.

