Hmmm... ho quasi capito.
Posto il codice così sono più chiaro:
Avendo copiato questo codice non mi è chiaro come salvare il file...Codice PHP:<?php
$hostname_conn = "localhost";
$database_conn = "database";
$username_conn = "root";
$password_conn = "password";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
// Query the database and get all the records from the Images table
mysql_select_db($database_conn, $conn);
$query_rsImages = "SELECT dataora, idzona, idnegozi, temp FROM datitemperature WHERE idnegozi=2";
$rsImages = mysql_query($query_rsImages, $conn) or die(mysql_error());
$row_rsImages = mysql_fetch_assoc($rsImages);
$totalRows_rsImages = mysql_num_rows($rsImages);
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
header('Content-Disposition: attachment; filename=resuslts.xml');
?><?php ('<?xml version="1.0" encoding="utf-8"?>'); ?>
<temperature>
<?php if ($totalRows_rsImages > 0) { // Show if recordset not empty ?>
<?php do { ?>
<dati>
<dataora><?php echo $row_rsImages['dataora']; ?></dataora>
<idzona><?php echo $row_rsImages['idzona']; ?></idzona>
<idnegozi><?php echo $row_rsImages['idnegozi']; ?></idnegozi>
<temp><?php echo $row_rsImages['temp']; ?></temp>
</dati>
<?php } while ($row_rsImages = mysql_fetch_assoc($rsImages)); ?>
<?php } // Show if recordset not empty ?>
</temperature>
<?php
mysql_free_result($rsImages);
?>

Rispondi quotando