Salut,
j'effectue une requete mysql avec un count qui compte le nombre de contact dans une entreprise et qui donne des rensegniement sur une entreprise donnée par le biais de jointures.
Ce que je voudrais, c'est que même si une entreprise contient 0 contact la ligne s'affiche quand même alors qu'avec ma requet actuelle seul les entreprise qui ont des contacts s'affiche
voici ma requete sql:
voi le code php qui affiche les information de l'entreprise.Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 SELECT count( contacts.ID_CONTACT ) as 'CONTACTS', entreprise.NOMENTREPRISE, entreprise.ADRESSEENTREPRISE, ville.VILLE, pays.PAYS, entreprise.TELEPHONE, entreprise.SITE_INTERNET from ((entreprise join ville on entreprise.ID_VILLE = ville.ID_VILLE) join pays on ville.ID_PAYS = pays.ID_PAYS) join contacts ON contacts.ID_ENTREPRISE = entreprise.ID_ENTREPRISE where entreprise.NOMENTREPRISE like '".$entreprise."%' GROUP BY entreprise.NOMENTREPRISE, entreprise.ADRESSEENTREPRISE, ville.VILLE, pays.PAYS, entreprise.TELEPHONE, entreprise.SITE_INTERNET";
Merci de votre aide.Code:
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 //on affiche la structure du tableau echo'<table border="1"> <caption>Resultat de la recherche</caption> <tr> <th>Entreprise </th> <th>Adresse </th> <th>Ville </th> <th>Pays </th> <th>Telephone Standard </th> <th>Site internet </th> <th>Contacts</th> </tr>'; // on va scanner tous les tuples un par un while ($data = mysql_fetch_array($resultat, MYSQL_ASSOC)) { // on affiche les résultats echo'<tr> <td>'.$data['NOMENTREPRISE'].'</td> <td>'.$data['ADRESSEENTREPRISE'].'</td> <td>'.$data['VILLE'].'</td> <td>'.$data['PAYS'].'</td> <td>'.$data['TELEPHONE'].'</td> <td><a href=http://'.$data['SITE_INTERNET'].'> '.$data['SITE_INTERNET'].'</a></td> <td><a href=../Controleur/controleur_recherche_contact.php?entreprise='.$data['NOMENTREPRISE'].'> '.$data['CONTACTS'].'</a></td> </tr>'; } echo'</table>';