[Conception] probleme d'affichage de plusieurs enregistrements
bonjour,
ce que j'aimerais faire c'est afficher le nom d'une entreprise ainsi que tous les employés (contacts) quelle contient. j'ai créé deux table, une entreprise et une autres contacts. Je fais mes requetes sur mes tables:
Citation:
$req = "SELECT * FROM entreprise WHERE 1=1";
//Ajout des conditions sur la rasion sociale//
if(@$_POST['raisonSociale'] != "")
{$req .= " AND EN_raisonSociale LIKE '%" . @$_POST['raisonSociale'] . "%'";
$raisonsociale=$_POST['raisonSociale'];
}
Citation:
$req_contacts = "SELECT * FROM contacts WHERE CO_EN_raisonSociale LIKE '%" . $row_rsGeneral['EN_raisonSociale'] . "%'";
j'ai un peu raccourci la première car elle controle plusieurs champs mais c'est juste pour vous donner une idée.
Le problème que j'ai est le suivant: quand il n'y a qu'une seule entreprise retournée avec ma requete, l'affichage se passe sans probleme mais lorsque a requete renvoi plusieurs entreprises ca devient le bordel la mise en forme n'existe plus et je ne recoit pas les employés des entreprises renvoyés après la 1ere entreprise.
mon code pour affciher les entreprise est le suivant.
Citation:
Citation:
<p> </p>
<form name="form3" method="post" action="">
<table width="95%"**border="0" cellspacing="0" cellpadding="0">
<?php do { ?>
<tr>
**<th colspan="2" scope="col">Entreprise</th>
</tr>
<tr>
**<td width="41%">Raison Sociale</td>
<td width="59%">
<?php echo $row_rsGeneral['EN_raisonSociale']; ?>
</td>
</tr>
<tr>
**<td>Adresse</td>
<td>
<?php echo $row_rsGeneral['EN_adresse']; ?>
</td>
</tr>
<tr>
**<td>Boite postale </td>
<td>
<?php echo $row_rsGeneral['EN_boitePostale']; ?></td>
</tr>
<tr>
**<td>Code postal</td>
**<td>
<?php echo $row_rsGeneral['EN_codePostal']; ?></td>
</tr>
<tr>
**<td>Ville</td>
<td>
<?php echo $row_rsGeneral['EN_ville']; ?>
</td>
</tr>
<tr>
**<td>Abonner</td>
<td>
<?php echo $row_rsGeneral['EN_abonner']; ?>
</td>
</tr>
<tr>
**<td>Secteur</td>
<td><?php echo $row_rsGeneral['EN_secteur']; ?>
</td>
</tr>
<tr>
**<td>Commentaire</td>
<td><?php echo $row_rsGeneral['EN_commentaire']; ?>
</td>
</tr>
<tr>
**<td>Numéro lettre début abonnement</td>
<td><?php echo $row_rsGeneral['EN_numDebutAbo']; ?>
</td>
</tr>
<tr>
**<td>Numéro lettre fin abonnement </td>
<td><?php echo $row_rsGeneral['EN_numFinAbo']; ?>
</td>
</tr>
<tr>
**<td>Téléphone de l'entreprise </td>
<td><?php echo $row_rsGeneral['EN_telephone']; ?>
</td>
</tr>
<tr>
**<td>Adresse Web </td>
<td><?php echo $row_rsGeneral['EN_web']; ?>
</td>
</tr>
<p> </p>
<p> </p>
<table width="95%"**border="0" cellspacing="0" cellpadding="0">
<?php
do {
?>
<tr>
**<th colspan="2" scope="col">Contacts</th>
</tr>
<tr>
**<td width="41%">Civilité</td>
**<td width="59%">
<?php echo $row_rsContacts['CO_civilite']; ?>
**</td>
</tr>
<tr>
**<td>Nom</td>
<td>
<?php echo $row_rsContacts['CO_nom']; ?>
</td>
</tr>
<tr>
**<td>Prénom </td>
<td>
<?php echo $row_rsContacts['CO_prénom']; ?>
</td>
</tr>
<tr>
**<td>Fonction</td>
<td>
<?php echo $row_rsContacts['CO_fonction']; ?>
</td>
</tr>
<tr>
**<td>Téléphone direct</td>
<td>
<?php echo $row_rsContacts['CO_telephoneFixe']; ?>
</td>
</tr>
<tr>
**<td>Téléphone portable</td>
<td>
<?php echo $row_rsContacts['CO_telephonePortable']; ?>
</td>
</tr>
<?php } while ($row_rsContacts = mysql_fetch_assoc($rsContacts)); ?>
</table>
<?php } while ($row_rsGeneral = mysql_fetch_assoc($rsGeneral)); ?>
<p> </p>
</form>
<p> </p>
</form>
<p> </p>
merci de votre aide.