<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[creare download di un echo]]></title><description><![CDATA[<p dir="auto">vorrei far eseguire il download all'utente di alcuni dati che ho in echo, cioè vorrei se possibile, inserirli in un foglio excel e scaricare il tutto.<br />
dunque, ho trovato uno script del genere, l'ho provato ma mi da diversi problemi e poi non mi crea nessun file xls</p>
<p dir="auto">&lt;?php<br />
session_start();<br />
?&gt;</p>
<p dir="auto">&lt;?php</p>
<p dir="auto">$id_user = $_SESSION['id_user'];<br />
$user = $_SESSION['user'];<br />
$gender = $_SESSION['gender'];<br />
$year=$_SESSION['year'];<br />
$month=$_SESSION['month'];<br />
$day=$_SESSION['day'];<br />
$country = $_SESSION['country'];<br />
$test_arousal_photo1 = $_SESSION['test_arousal_photo1'];<br />
$test_valence_photo1 = $_SESSION['test_valence_photo1'];<br />
$test_arousal_photo2 = $_SESSION['test_arousal_photo2'];<br />
$test_valence_photo2 = $_SESSION['test_valence_photo2'];<br />
$test_arousal_photo3 = $_SESSION['test_arousal_photo3'];<br />
$test_valence_photo3 = $_SESSION['test_valence_photo3'];<br />
$test_arousal_photo4 = $_SESSION['test_arousal_photo4'];<br />
$test_valence_photo4 = $_SESSION['test_valence_photo4'];<br />
$test_arousal_photo5 = $_SESSION['test_arousal_photo5'];<br />
$test_valence_photo5 = $_SESSION['test_valence_photo5'];<br />
$test_arousal_photo6 = $_SESSION['test_arousal_photo6'];<br />
$test_valence_photo6 = $_SESSION['test_valence_photo6'];<br />
$test_arousal_photo7 = $_SESSION['test_arousal_photo7'];<br />
$test_valence_photo7 = $_SESSION['test_valence_photo7'];<br />
$test_arousal_photo8 = $_SESSION['test_arousal_photo8'];<br />
$test_valence_photo8 = $_SESSION['test_valence_photo8'];<br />
$test_arousal_photo9 = $_SESSION['test_arousal_photo9'];<br />
$test_valence_photo9 = $_SESSION['test_valence_photo9'];<br />
$test_arousal_photo10 = $_SESSION['test_arousal_photo10'];<br />
$test_valence_photo10 = $_SESSION['test_valence_photo10'];</p>
<p dir="auto">if($test_arousal_photo1==null){$test_arousal_photo1="NULL";}<br />
if($test_valence_photo1==null){$test_valence_photo1="NULL";}<br />
if($test_arousal_photo2==null){$test_arousal_photo2="NULL";}<br />
if($test_valence_photo2==null){$test_valence_photo2="NULL";}<br />
if($test_arousal_photo3==null){$test_arousal_photo3="NULL";}<br />
if($test_valence_photo3==null){$test_valence_photo3="NULL";}<br />
if($test_arousal_photo4==null){$test_arousal_photo4="NULL";}<br />
if($test_valence_photo4==null){$test_valence_photo4="NULL";}<br />
if($test_arousal_photo5==null){$test_arousal_photo5="NULL";}<br />
if($test_valence_photo5==null){$test_valence_photo5="NULL";}<br />
if($test_arousal_photo6==null){$test_arousal_photo6="NULL";}<br />
if($test_valence_photo6==null){$test_valence_photo6="NULL";}<br />
if($test_arousal_photo7==null){$test_arousal_photo7="NULL";}<br />
if($test_valence_photo7==null){$test_valence_photo7="NULL";}<br />
if($test_arousal_photo8==null){$test_arousal_photo8="NULL";}<br />
if($test_valence_photo8==null){$test_valence_photo8="NULL";}<br />
if($test_arousal_photo9==null){$test_arousal_photo9="NULL";}<br />
if($test_valence_photo9==null){$test_valence_photo9="NULL";}<br />
if($test_arousal_photo10==null){$test_arousal_photo10="NULL";}<br />
if($test_valence_photo10==null){$test_valence_photo10="NULL";}</p>
<p dir="auto">$connessione=mysql_connect("localhost", "");<br />
$selezione_db=mysql_select_db("guest_book", $connessione);</p>
<p dir="auto">echo "welcome ";<br />
echo" &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt; your values:&lt;BR&gt;<br />
&lt;BR&gt;test arousal photo1=   ". $test_arousal_photo1 ."&lt;br&gt;test valence photo1=    " .$test_valence_photo1 .<br />
"&lt;br&gt;test arousal photo2=   " . $test_arousal_photo2 . "&lt;br&gt;test valence photo2=    " . $test_valence_photo2 .<br />
"&lt;br&gt;test arousal photo3=   " . $test_arousal_photo3 . "&lt;br&gt;test valence photo3=    " . $test_valence_photo3 .<br />
"&lt;br&gt;test arousal photo4=   " . $test_arousal_photo4 . "&lt;br&gt;test valence photo4=    " . $test_valence_photo4 .<br />
"&lt;br&gt;test arousal photo5=   " . $test_arousal_photo5 . "&lt;br&gt;test valence photo5=    " . $test_valence_photo5 .<br />
"&lt;br&gt;test arousal photo6=   " . $test_arousal_photo6 . "&lt;br&gt;test valence photo6=    " . $test_valence_photo6 .<br />
"&lt;br&gt;test arousal photo7=   " . $test_arousal_photo7 . "&lt;br&gt;test valence photo7=    " . $test_valence_photo7 .<br />
"&lt;br&gt;test arousal photo8=   " . $test_arousal_photo8 . "&lt;br&gt;test valence photo8=    " . $test_valence_photo8 .<br />
"&lt;br&gt;test arousal photo9=   " . $test_arousal_photo9 . "&lt;br&gt;test valence photo9=    " . $test_valence_photo9 .<br />
"&lt;br&gt;test arousal photo10=   " . $test_arousal_photo10 . "&lt;br&gt;test valence photo10=    " . $_SESSION['test_valence_photo10'];</p>
<p dir="auto">$query="INSERT INTO messaggi (id_user,user,gender,date_of_birth,country,test_arousal_photo1,test_valence_photo1,test_arousal_photo2,test_valence_photo2,test_arousal_photo3,test_valence_photo3,test_arousal_photo4,test_valence_photo4,test_arousal_photo5,test_valence_photo5,test_arousal_photo6,test_valence_photo6,test_arousal_photo7,test_valence_photo7,test_arousal_photo8,test_valence_photo8,test_arousal_photo9,test_valence_photo9,test_arousal_photo10,test_valence_photo10,date)";<br />
$query.=" VALUES ('$id_user','$user','$gender','$year-$month-$day','$country',$test_arousal_photo1,$test_valence_photo1,$test_arousal_photo2,$test_valence_photo2,$test_arousal_photo3,$test_valence_photo3,$test_arousal_photo4,$test_valence_photo4,$test_arousal_photo5,$test_valence_photo5,$test_arousal_photo6,$test_valence_photo6,$test_arousal_photo7,$test_valence_photo7,$test_arousal_photo8,$test_valence_photo8,$test_arousal_photo9,$test_valence_photo9,$test_arousal_photo10,$test_valence_photo10, now())" ;</p>
<p dir="auto">$inserimento=mysql_query($query);<br />
mysql_close($connessione);</p>
<p dir="auto">?&gt;</p>
<p dir="auto">&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;p&gt;&lt;BR&gt;<br />
&lt;BR&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;&lt;BR&gt;<br />
&lt;BR&gt;<br />
&lt;img src="image value.JPG" alt="image value" width="600 height=" height="748"800" /&gt;                             &lt;img src="valence-arousal.JPG" alt="valence arousal" width="551" height="540" /&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;p align="right"&gt;<br />
&lt;title&gt;&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p dir="auto">&lt;?php<br />
$DB_Server = "localhost"; //your MySQL Server<br />
$DB_Username = ""; //your MySQL User Name<br />
$DB_Password = ""; //your MySQL Password<br />
$DB_DBName = "guest_book"; //your MySQL Database Name<br />
$DB_TBLName = "messaggi"; //your MySQL Table Name</p>
<p dir="auto">$sql = "Select * from $DB_TBLName";</p>
<p dir="auto">//create MySQL connection<br />
$Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password)<br />
or die("Couldn't connect to MySQL:&lt;br&gt;" . mysql_error() . "&lt;br&gt;" . mysql_errno());<br />
//select database<br />
$Db = @mysql_select_db($DB_DBName, $Connect)<br />
or die("Couldn't select database:&lt;br&gt;" . mysql_error(). "&lt;br&gt;" . mysql_errno());<br />
//execute query<br />
$result = @mysql_query($sql,$Connect)<br />
or die("Couldn't execute query:&lt;br&gt;" . mysql_error(). "&lt;br&gt;" . mysql_errno());</p>
<p dir="auto">$file_type = "vnd.ms-excel";<br />
$file_ending = "xls";</p>
<p dir="auto">//header info for browser: determines file type ('.doc' or '.xls')<br />
header("Content-Type: application/$file_type");<br />
header("Content-Disposition: attachment; filename=prova1.$file_ending");<br />
header("Pragma: no-cache");<br />
header("Expires: 0");</p>
<p dir="auto">/* Start of Formatting for Word or Excel */</p>
<p dir="auto">//define separator (defines columns in excel &amp; tabs in word)<br />
$sep = "\t"; //tabbed character</p>
<p dir="auto">//start of printing column names as names of MySQL fields<br />
for ($i = 0; $i &lt; mysql_num_fields($result); $i++)<br />
{<br />
echo mysql_field_name($result,$i) . "\t";<br />
}<br />
print("\n");<br />
//end of printing column names</p>
<p dir="auto">//start while loop to get data<br />
while($row = mysql_fetch_row($result))<br />
{<br />
//set_time_limit(60); // HaRa<br />
$schema_insert = "";<br />
for($j=0; $j&lt;mysql_num_fields($result);$j++)<br />
{<br />
if(!isset($row[$j]))<br />
$schema_insert .= "NULL".$sep;<br />
elseif ($row[$j] != "")<br />
$schema_insert .= "$row[$j]".$sep;<br />
else<br />
$schema_insert .= "".$sep;<br />
}<br />
$schema_insert = str_replace($sep."$", "", $schema_insert);<br />
$schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert);<br />
$schema_insert .= "\t";<br />
print(trim($schema_insert));<br />
print "\n";<br />
}</p>
<p dir="auto">?&gt;</p>
]]></description><link>https://dev.connect.gt/topic/70183/creare-download-di-un-echo</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 03:48:23 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/70183.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 29 Apr 2008 22:28:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to creare download di un echo on Fri, 09 May 2008 11:47:33 GMT]]></title><description><![CDATA[<p dir="auto">sbagli a mettere l'html prima di</p>
<pre><code>//header info for browser: determines file type ('.doc' or '.xls') 
header("Content-Type: application/$file_type"); 
header("Content-Disposition: attachment; filename=prova1.$file_ending"); 
header("Pragma: no-cache"); 
header("Expires: 0");
</code></pre>
]]></description><link>https://dev.connect.gt/post/708364</link><guid isPermaLink="true">https://dev.connect.gt/post/708364</guid><dc:creator><![CDATA[skyline]]></dc:creator><pubDate>Fri, 09 May 2008 11:47:33 GMT</pubDate></item><item><title><![CDATA[Reply to creare download di un echo on Thu, 08 May 2008 14:49:48 GMT]]></title><description><![CDATA[<p dir="auto">il problema è questo adesso:<br />
<strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at c:\programmi\easyphp1-8\www\salvastep2.php:8) in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>137</strong></p>
<p dir="auto"><strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at c:\programmi\easyphp1-8\www\salvastep2.php:8) in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>138</strong></p>
<p dir="auto"><strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at c:\programmi\easyphp1-8\www\salvastep2.php:8) in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>139</strong></p>
<p dir="auto"><strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at c:\programmi\easyphp1-8\www\salvastep2.php:8) in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>140</strong></p>
<p dir="auto">cosa sbaglio?</p>
]]></description><link>https://dev.connect.gt/post/708367</link><guid isPermaLink="true">https://dev.connect.gt/post/708367</guid><dc:creator><![CDATA[giorgiodp]]></dc:creator><pubDate>Thu, 08 May 2008 14:49:48 GMT</pubDate></item><item><title><![CDATA[Reply to creare download di un echo on Tue, 06 May 2008 18:14:39 GMT]]></title><description><![CDATA[<p dir="auto">no, purtroppo mi invalida le variabili e quindi scrive cosi':</p>
<p dir="auto"><strong>Notice</strong>: Undefined index: id_user in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>11</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: user in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>12</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: gender in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>13</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: year in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>14</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: month in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>15</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: day in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>16</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: country in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>17</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo1 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>18</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo1 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>19</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo2 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>20</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo2 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>21</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo3 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>22</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo3 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>23</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo4 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>24</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo4 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>25</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo5 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>26</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo5 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>27</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo6 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>28</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo6 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>29</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo7 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>30</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo7 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>31</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo8 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>32</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo8 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>33</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo9 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>34</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo9 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>35</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_arousal_photo10 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>36</strong></p>
<p dir="auto"><strong>Notice</strong>: Undefined index: test_valence_photo10 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>37</strong><br />
welcome<br />
<strong>Notice</strong>: Undefined index: test_valence_photo10 in <strong>c:\programmi\easyphp1-8\www\salvastep2.php</strong> on line <strong>85</strong></p>
<p dir="auto">your values:</p>
<p dir="auto">test arousal photo1=   NULL<br />
test valence photo1=    NULL<br />
test arousal photo2=   NULL<br />
test valence photo2=    NULL<br />
test arousal photo3=   NULL<br />
test valence photo3=    NULL<br />
test arousal photo4=   NULL<br />
test valence photo4=    NULL<br />
test arousal photo5=   NULL<br />
test valence photo5=    NULL<br />
test arousal photo6=   NULL<br />
test valence photo6=    NULL<br />
test arousal photo7=   NULL<br />
test valence photo7=    NULL<br />
test arousal photo8=   NULL<br />
test valence photo8=    NULL<br />
test arousal photo9=   NULL<br />
test valence photo9=    NULL<br />
test arousal photo10=   NULL<br />
test valence photo10=    Couldn't connect to MySQL:<br />
Accesso non consentito per l'utente: 'ODBC'@'localhost' (Password: NO)<br />
1045</p>
]]></description><link>https://dev.connect.gt/post/708366</link><guid isPermaLink="true">https://dev.connect.gt/post/708366</guid><dc:creator><![CDATA[giorgiodp]]></dc:creator><pubDate>Tue, 06 May 2008 18:14:39 GMT</pubDate></item><item><title><![CDATA[Reply to creare download di un echo on Tue, 06 May 2008 08:40:29 GMT]]></title><description><![CDATA[<p dir="auto">Prova a togliere tutta l'intestazione html, e cioè :</p>
<p dir="auto">&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;p&gt;&lt;BR&gt;<br />
&lt;BR&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;&lt;BR&gt;<br />
&lt;BR&gt;<br />
&lt;img src="image value.JPG" alt="image value" width="600 height=" height="748"800" /&gt; &lt;img src="valence-arousal.JPG" alt="valence arousal" width="551" height="540" /&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;p align="right"&gt;<br />
&lt;title&gt;&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p dir="auto">vedrai che così facendo se il resto dello script è corretto quando verrà richiesto non  aprirà una nuova pagina, ma la quasiica finestrina per i download.</p>
]]></description><link>https://dev.connect.gt/post/708374</link><guid isPermaLink="true">https://dev.connect.gt/post/708374</guid><dc:creator><![CDATA[deving]]></dc:creator><pubDate>Tue, 06 May 2008 08:40:29 GMT</pubDate></item></channel></rss>