<?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[Agenda appuntamenti con più utenti]]></title><description><![CDATA[<p dir="auto">Buongiorno a tutti,<br />
sono fermo a un punto dove non riesco a risolvero e avrei bisogno del vostro supporto.<br />
Ho una tabella Appuntamenti composta da un id, data appuntamento, ora inizio, ora fine e utente interessato.<br />
Nella tabella Appuntamenti concorrono più utenti.<br />
Vorrei fare una query dove mi restituisce solo gli orari che sono occupati da tutti gli utenti contemporaneamente<br />
Esempio:<br />
oggi  02/11/2017 dalle ore 11:00 alle 12:00 tutti gli utenti interessato hanno un'appuntamento quindi la risposta vorrei che fosse full<br />
oggi  03/11/2017 dalle ore 11:00 alle 12:00 solo due utenti interessati hanno un'appuntamento quindi la risposta vorrei che fosse free</p>
<p dir="auto">HO provato a fare una query, ma mi da come risposta full  anche se solo un utente ha l'ora occupata nonostante gli altri utenti  siano liberi.</p>
<pre><code class="language-php">$query= "SELECT * FROM utenti";
$Recordset = mysql_query($query, $mcl) or die(mysql_error());
while($row=mysql_fetch_row($Recordset)) 
                                                        { 
                                                         $id_utente_abilitato=$row[0]; 
$query_a= "SELECT * FROM appuntamento where giorno_app='$data_appu' and ora_inizio&lt;='$ora_cont' and ora_fine&gt;='$ora_cont' and id_utente='$id_utente_abilitato'";
$Recordset_a = mysql_query($query_a, $mcl) or die(mysql_error());
while($row_a=mysql_fetch_row($Recordset)) 
                                                        {
                                                        $id_libero=$row_a[0];
}}
</code></pre>
<p dir="auto">Grazie e ciao a tutti <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://dev.connect.gt/topic/232209/agenda-appuntamenti-con-più-utenti</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 01:10:07 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/232209.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Nov 2017 11:31:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Agenda appuntamenti con più utenti on Mon, 13 Nov 2017 20:15:00 GMT]]></title><description><![CDATA[<p dir="auto">Ciao leslie2016<br />
credo che il problema sia come hai strutturato le query. In questo tuo modo se l'ultimo utente della lista ha un'appuntamento il risultato sarà true di sicuro. Prova così: in questo modo con il break dovrebbe uscire se un utente non ha appuntamenti.</p>
<pre><code>[COLOR=#0000BB][FONT=monospace]$query[/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"SELECT * FROM utenti"[/FONT][/COLOR][COLOR=#007700][FONT=monospace];
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$Recordset [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_query[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$query[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$mcl[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) or die([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_error[/FONT][/COLOR][COLOR=#007700][FONT=monospace]());
while([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$row[/FONT][/COLOR][COLOR=#007700][FONT=monospace]=[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_fetch_row[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$Recordset[/FONT][/COLOR][COLOR=#007700][FONT=monospace])) 
{ 
[/FONT][/COLOR][FONT=monospace][COLOR=#007700] [/COLOR][/FONT][COLOR=#0000BB][FONT=monospace]$id_utente_abilitato[/FONT][/COLOR][COLOR=#007700][FONT=monospace]=[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$row[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]0[/FONT][/COLOR][COLOR=#007700][FONT=monospace]]; 
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace] $query_a[/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"SELECT * FROM appuntamento where giorno_app='[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$data_appu[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' and ora_inizio&lt;='[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$ora_cont[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' and ora_fine&gt;='[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$ora_cont[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' and id_utente='[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$id_utente_abilitato[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'"[/FONT][/COLOR][COLOR=#007700][FONT=monospace];
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace] $Recordset_a [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_query[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$query_a[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$mcl[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) or die([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_error[/FONT][/COLOR][COLOR=#007700][FONT=monospace]());
 $entrato = false;
 while([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$row_a[/FONT][/COLOR][COLOR=#007700][FONT=monospace]=[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_fetch_row[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$Recordset[/FONT][/COLOR][COLOR=#007700][FONT=monospace])) 
 {
    $entrato = true;
    [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$id_libero[/FONT][/COLOR][COLOR=#007700][FONT=monospace]=[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$row_a[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]0[/FONT][/COLOR][COLOR=#007700][FONT=monospace]];
 }
 if($entrato==false)
    break;
}  

[/FONT][/COLOR]
</code></pre>
]]></description><link>https://dev.connect.gt/post/1243105</link><guid isPermaLink="true">https://dev.connect.gt/post/1243105</guid><dc:creator><![CDATA[pietror]]></dc:creator><pubDate>Mon, 13 Nov 2017 20:15:00 GMT</pubDate></item></channel></rss>