J'ai un petit problème avec les fonctions.
J'ai une table RESULTAT avec deschamp id, date, sortie et nbre_participant
J'aimerai créer une fonction test($date); qui va calculer pour une date donnée le nombre de participants et le renvoyer dans un tableau avec le nom de la sortie.
function test($date)
{
$participants="0";
$query = "SELECT * from resultat WHERE date='$date' order by id";
$result = mysql_db_query("$bdd", $query);
while ($r = mysql_fetch_array($result)) {
$nbre_participant=$r['nbre_participant'];
$sortie=$r['sortie'];
$participants=$participants+$nbre_participant;
}
return array($participants, $sortie);
}
Or quand j'appelle cette fonction : je n'ai aucuns résultats qui s'affichent
$retour_test= test($date);
echo $retour_test[0];
echo $retour_test[1];
Vous auriez une idée pour m'aider ?Merci