<?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[Formattare correttamente ril risultato di una query (PHP / MySql)]]></title><description><![CDATA[<p dir="auto">Ciao a tutti,<br />
vi propongo un quesito sperando di trovare una soluzione!</p>
<p dir="auto">Ho creato questa query:</p>
<p dir="auto">SELECT Giorno_set, Livello, Orario<br />
FROM a, b, c<br />
WHERE a.Gruppo = b.gruppo<br />
AND b.giorno_set = c.Giorno<br />
AND a.Vie = 'Ven'<br />
AND b.Civici_Utenze = '4'<br />
ORDER BY a.posizione, a.livello</p>
<p dir="auto">e la stampo a video in questo modo:</p>
<p dir="auto">$risultato=mysql_query($query);<br />
$numrows = mysql_num_rows($risultato);<br />
for ($x = 0; $x &lt; $numrows; $x++){<br />
$resrow = mysql_fetch_row($risultato);<br />
$giorno_set = $resrow[0];<br />
$livello = $resrow[1];<br />
$Orario = $resrow[2];<br />
echo "<br />
&lt;tr&gt;<br />
&lt;td&gt;" . $giorno_set . "&lt;/b&gt;&lt;/td&gt;<br />
&lt;td&gt;" . $livello . "&lt;/b&gt;&lt;/td&gt;<br />
&lt;td&gt;" . $Orario . "&lt;/b&gt;&lt;/td&gt;<br />
&lt;/tr&gt;</p>
<p dir="auto">ottenendo una tabella come questa:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><strong>Giorno</strong></th>
<th><strong>Livello</strong></th>
<th><strong>Orario</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>LUNEDI</td>
<td>2</td>
<td>12.00 ? 13.30</td>
</tr>
<tr>
<td>LUNEDI</td>
<td>4</td>
<td>16.30 ? 18.00</td>
</tr>
<tr>
<td>MARTEDI</td>
<td>2</td>
<td>16.30 ? 18.00</td>
</tr>
<tr>
<td>MARTEDI</td>
<td>4</td>
<td>12.00 ? 13.30</td>
</tr>
<tr>
<td>MERCOLEDI</td>
<td>1</td>
<td>12.00 ? 13.30</td>
</tr>
<tr>
<td>MERCOLEDI</td>
<td>5</td>
<td>16.30 ? 18.00</td>
</tr>
</tbody>
</table>
<p dir="auto">Io però vorrei ottenere questo risultato:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><strong>Giorno Settimana</strong></th>
<th><strong>Livello 1</strong></th>
<th><strong>Livello 2</strong></th>
<th><strong>Livello 3</strong></th>
<th><strong>Livello 4</strong></th>
<th><strong>Livello 5</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>LUNEDI</strong></td>
<td></td>
<td>12.00 - 13.30</td>
<td></td>
<td>16.30 - 18.00</td>
<td></td>
</tr>
<tr>
<td><strong>MARTED</strong></td>
<td></td>
<td>16.30 - 18.00</td>
<td></td>
<td>12.00 - 13.30</td>
<td></td>
</tr>
<tr>
<td><strong>MERCOLED</strong></td>
<td>12.00 - 13.30</td>
<td></td>
<td></td>
<td></td>
<td>16.30 - 18.00</td>
</tr>
</tbody>
</table>
<p dir="auto">qualcuno può aiutarmi?</p>
<p dir="auto">Grazie!</p>
]]></description><link>https://dev.connect.gt/topic/217320/formattare-correttamente-ril-risultato-di-una-query-php-mysql</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 02:35:19 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/217320.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Sep 2015 07:59:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Formattare correttamente ril risultato di una query (PHP / MySql) on Thu, 17 Sep 2015 14:58:03 GMT]]></title><description><![CDATA[<p dir="auto">Sicuramente per non toccare la query dovresti salvare i risultati in una matrice e scorrere quella(ipotizzo con un for che scorre tutte le righe e un while che controlla se ci sono altre righe uguali a quella che stai scorrendo))<br />
però sono solo ipotesi, bisognerebbe fare dei test seri</p>
]]></description><link>https://dev.connect.gt/post/1207286</link><guid isPermaLink="true">https://dev.connect.gt/post/1207286</guid><dc:creator><![CDATA[pietror]]></dc:creator><pubDate>Thu, 17 Sep 2015 14:58:03 GMT</pubDate></item><item><title><![CDATA[Reply to Formattare correttamente ril risultato di una query (PHP / MySql) on Thu, 17 Sep 2015 09:44:18 GMT]]></title><description><![CDATA[<p dir="auto">Ciao Pietro, purtroppo no, ho fatto un po' di tentativi ma non ne vengo a capo..<br />
Fin'ora non ho toccato la query ma inizio a credere sia l'unico modo...</p>
]]></description><link>https://dev.connect.gt/post/1207293</link><guid isPermaLink="true">https://dev.connect.gt/post/1207293</guid><dc:creator><![CDATA[thaco]]></dc:creator><pubDate>Thu, 17 Sep 2015 09:44:18 GMT</pubDate></item><item><title><![CDATA[Reply to Formattare correttamente ril risultato di una query (PHP / MySql) on Thu, 17 Sep 2015 07:47:23 GMT]]></title><description><![CDATA[<p dir="auto">Ciao Thaco e benvenuto nel ForumGT<br />
sei riuscito a fare progressi con il tuo problema? Io personalmente lavorerei sulla presentazione dei risultati e lascerei la query MySQL intatta.<br />
Potresti fare un ciclo fra i tuoi risultati e se il giorno è lo stesso incasellarli nel modo corretto.</p>
]]></description><link>https://dev.connect.gt/post/1207281</link><guid isPermaLink="true">https://dev.connect.gt/post/1207281</guid><dc:creator><![CDATA[pietror]]></dc:creator><pubDate>Thu, 17 Sep 2015 07:47:23 GMT</pubDate></item></channel></rss>