appel fonction avec choix de deux affichage
Posté : 22 août 2010, 23:38
Bonsoir,
J'ai fait une fonction pour afficher des bières, bière noir, bière blanche etc.
J'appel ma function
J'aurai bien aimé mélanger deux sorte de bière, exemple : la biere noir avec la bière blanche.
J'ai fait comme ceci mais bon cela ne fonctionne pas sniff
J'ai fait une fonction pour afficher des bières, bière noir, bière blanche etc.
J'appel ma function
affiche_biere("noir", 4);
J'affiche donc toute mes bières noir, sur une ligne de 4.J'aurai bien aimé mélanger deux sorte de bière, exemple : la biere noir avec la bière blanche.
J'ai fait comme ceci mais bon cela ne fonctionne pas sniff
affiche_biere("noir","blanche", 4);
Ma fonction :
function affiche_biere($type, $max)
{
$sql_donne = "select id,titre,img from site_biere where type= '$type'";
$sql_donne = $db->query($sql_donne);
$i = 0;
echo '<table width="500"><tr>';
$taille_col = 100 / $max;
if($db->num_rows($sql_donne) > 0)
{
while($var = $db->fetch_assoc($sql_donne))
{
if(($i % $max) == 0)
echo '</tr><tr>';
echo '<td width="'.$taille_col.'%"><a href="biere.php?biere='.$var['id'].'" style="text-decoration:none"><img src="biere/img/'.$var['img'].'" alt="'.$var['titre'].'" title="'.$var['titre'].'" border="0" />
<br>';
$i++;
}
}else
{
echo '<td align="center">Aucune bière</td>';
}
echo '</tr></table>';
}
Merci de votre aide !