Bonjour,

Je fais une requête pour voir les chevauchements de date dans ma base.
Je veux s'il y'a des chevauchements, construire un tableau sinon afficher un simple message
voici mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
include('functions.php');
         $bdd_mission_msas=connect();
		 $mission_depart_id_chevauch=$_POST['mission_depart_id']; 
$reponse_bureau_depart = $bdd_mission_msas->query('SELECT
 A.prenom,A.nom,
 M1.motif as "motif1", 
 M1.depart_mission as "depart_mission1",
 M1.arrivee_mission as "arrivee_mission1",
 M2.motif as "motif2",
 M2.depart_mission as "depart_mission2", 
 M2.arrivee_mission as "arrivee_mission2"
 FROM mission_agents MA1 INNER JOIN mission_agents MA2 ON MA1.agent_id = MA2.agent_id AND MA1.mission_id < MA2.mission_id
 INNER JOIN missions M1 ON MA1.mission_id = M1.mission_id
 INNER JOIN missions M2 ON MA2.mission_id = M2.mission_id
 INNER JOIN agent A ON MA1.agent_id = A.agent_id WHERE M1.depart_mission <= M2.arrivee_mission AND M1.arrivee_mission >= M2.depart_mission and MA1.mission_id='. $mission_depart_id_chevauch.'');
 
						//$donnees_mission_agents_page = $reponse_bureau_depart->fetch();
					if($reponse_bureau_depart ->rowCount() == 0)	
					{
						 echo 'Pas de chevauchements trouvées sur cette mission'; 
					}
else
{	
 
		while ($donnees_mission_agents_page = $reponse_bureau_depart->fetch())
{
	    //$date_mission_fiche=date("d/m/Y", strtotime($donnees_mission_fiche ['depart_mission']));
		$prenom_agent_chevauch=$donnees_mission_agents_page ['prenom'];
		$nom_agent_chevauch=$donnees_mission_agents_page ['nom'];
		$motif1=$donnees_mission_agents_page ['motif1'];
		$date_depart_mission1=$donnees_mission_agents_page ['depart_mission1'];
		$date_arrive_mission1=$donnees_mission_agents_page ['arrivee_mission1'];
		$motif2=$donnees_mission_agents_page ['motif2'];
		$date_depart_mission2=$donnees_mission_agents_page ['depart_mission2'];
		$date_arrivee_mission2=$donnees_mission_agents_page ['arrivee_mission2'];
		$htm0_mission .='<tbody>
         <tr>
         <td>'.$prenom_agent_chevauch.'</td>';
          $htm0_mission .='<td>'.$nom_agent_chevauch.'</td>';
		   $htm0_mission .='<td>participe à une mission</td>';
           $htm0_mission .='<td>'.$motif1.'</td>';
           $htm0_mission .='<td>'.$date_depart_mission1.'</td>';
		    $htm0_mission .='<td>'.$date_arrive_mission1.'</td>';
			 $htm0_mission .='<td>en chevauchement avec</td>';
			  $htm0_mission .='<td>'.$motif2.'</td>';
			   $htm0_mission .='<td>'.$date_depart_mission2.'</td>';
			    $htm0_mission .='<td>'.$date_arrivee_mission2.'</td>';
		   		$htm0_mission .='</tr>';
			}
 
$reponse_bureau_depart->closeCursor();
 $htm0_mission .='</tbody></table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>';
		echo $htm0_mission;  
}
Mais ça marche pas

Quelle est la solution ?