par
auclairp » 20 août 2009, 02:44
Voici, j'ai généré un tableau avec une liste de personne, dans ce tableau de désire faire un "double count", c'est a dire, d'après la clef primaire, soit la personne (user) je désire compter les éléments correspondant à cette personne dans deux table, voici ce que j'ai fait, mais cela ne fonctionne pas....
<?
$listing_first = "SELECT COUNT(*) AS nb_dvd, code, user, date_retour
FROM all_loan
WHERE all_loan.date_retour = ''
GROUP BY user";
$resultat_first = mysql_query($listing_first);
?>
<form action="prets.php" method="post">
<?
while ($rows = mysql_fetch_array($resultat_first))
{
$listing_first9 = "SELECT COUNT(*) AS nb_favoris, code, user
FROM panier WHERE user= '".$rows['user']."'";
$donnees1 = mysql_fetch_array($listing_first9);
?>
<tr class="loan">
<td class="multi-code-form"><? echo $rows['nb_dvd']; ?></td>
<td class="multi-code-form"><? echo $donnees1['nb_favoris'];?></td>
<td class="multi-nom-form"><? echo $rows['user']; ?></td>
<td class="multi-nom-form">
</td>
</tr>
<? } ?>
Pouvez-vous m'aider. Merci
Voici, j'ai généré un tableau avec une liste de personne, dans ce tableau de désire faire un "double count", c'est a dire, d'après la clef primaire, soit la personne (user) je désire compter les éléments correspondant à cette personne dans deux table, voici ce que j'ai fait, mais cela ne fonctionne pas....
[php]
<?
$listing_first = "SELECT COUNT(*) AS nb_dvd, code, user, date_retour
FROM all_loan
WHERE all_loan.date_retour = ''
GROUP BY user";
$resultat_first = mysql_query($listing_first);
?>
<form action="prets.php" method="post">
<?
while ($rows = mysql_fetch_array($resultat_first))
{
$listing_first9 = "SELECT COUNT(*) AS nb_favoris, code, user
FROM panier WHERE user= '".$rows['user']."'";
$donnees1 = mysql_fetch_array($listing_first9);
?>
<tr class="loan">
<td class="multi-code-form"><? echo $rows['nb_dvd']; ?></td>
<td class="multi-code-form"><? echo $donnees1['nb_favoris'];?></td>
<td class="multi-nom-form"><? echo $rows['user']; ?></td>
<td class="multi-nom-form">
</td>
</tr>
<? } ?>
[/php]
Pouvez-vous m'aider. Merci