<?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[Come esportare 2 tabelle mysql in un file excel]]></title><description><![CDATA[<p dir="auto">Ciao a tutti.<br />
Come da titolo avrei la necessità di esportare due tabelle mysql in un solo file excel. La prima tabella deve essere esportata nel Foglio1 e la seconda nel Foglio2. Ovviamente il tutto deve avvenire tramite codice PHP.<br />
Per estrarre una sola tabella scrivo un codice tipo questo:</p>
<pre><code>$con = new MySQLi('host', 'user', 'pass', 'database');
$query = "SELECT colonna1, colonna2 FROM tabella ORDER BY id";
$result = $con -&gt; query($query);
for ($i = 0; $i &lt;= mysqli_num_fields($result); $i++)
{
    $info_col = mysqli_fetch_field($result);
    $nomi_col = $info_col -&gt; name;
    echo $info_col -&gt; name . "\t";
}
$set_data = '';
while ($row = mysqli_fetch_row($result))
{
    $row_data = '';
    foreach ($row as $value)
    {
        $value = '"' . str_replace ('.',',',$value) . '"' ."\t";
        $row_data .= $value;
    }
    $set_data .= trim ($row_data) . "\n";
}
    
header("Content-type: application/octet-stream");  
header("Content-Disposition: attachment; filename=Monitoraggio.xls");  
header("Pragma: no-cache");  
header("Expires: 0");  
  
echo "\n" . $set_data . "\n";
</code></pre>
<p dir="auto">Come potrei fare per esportare due tabelle nel modo in cui ho scritto prima?<br />
Ciao, grazie mille a tutti.</p>
]]></description><link>https://dev.connect.gt/topic/237058/come-esportare-2-tabelle-mysql-in-un-file-excel</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 00:50:14 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/237058.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Jan 2019 17:59:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Come esportare 2 tabelle mysql in un file excel on Thu, 24 Jan 2019 14:30:08 GMT]]></title><description><![CDATA[<p dir="auto">Ti occorre una libreria, puoi provare PhpSpreadsheet</p>
<p dir="auto"><a href="http://github.com/PHPOffice/PhpSpreadsheet" rel="nofollow ugc">github.com/PHPOffice/PhpSpreadsheet</a></p>
]]></description><link>https://dev.connect.gt/post/1254926</link><guid isPermaLink="true">https://dev.connect.gt/post/1254926</guid><dc:creator><![CDATA[flaviors200]]></dc:creator><pubDate>Thu, 24 Jan 2019 14:30:08 GMT</pubDate></item></channel></rss>