allora devo mandare un output di una funzione ad un file
ecco il codice:
mysql_connect("localhost", "guest", "xxxxx") or die ( "non posso connettermi al server");
mysql_select_db("online");
function scrivi_file($x1) {
$dest = "/var/www/html/pubblish.html";
$resource = fopen($dest,'w+');
fwrite($resource,$x1);
fclose($resource);
}
function crea_output(){
$risultato = mysql_query("select * from `usati` ORDER BY `cilindrata` ASC" ) or die (mysql_error());
while ($row = mysql_fetch_array($risultato))
{
$foto = "foto/".$row['img'];
echo "
<table width=500 border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=middle background=images/finestra_01.jpg align=center height=40><div class=finestra>::
".$row['data']." ::</div></td>
</tr>
<tr>
<td valign=top background=images/finestra_02.jpg align=center>
<table cellpadding=0 cellspacing=0>
<td width=123 valign=top>
<p class=finestra>
Marca :
Modello:
Cilindrata:
Colore:
Anno:
Km:
Prezzo:
Note:</P></TD>
</P></TD>
<td width=167 align=center><IMG height=113 src=". $foto .
" width=150 style='border: solid; border-color: #cccccc;'>
</TD></TR></table>
<tr>
<td>[img]images/finestra_03.jpg[/img]</td>
</tr>
</table> ";}
}
$html = crea_output();
$testo = strval($html);
scrivi_file($testo);
qualche idea?
thanx