Swith() fonctionne pas ?
Posté : 19 mai 2005, 18:46
Code : Tout sélectionner
<?
$connexion = mysql_connect($host,$user,$mopass);
$selection = mysql_select_db($db,$connexion);
$sqlphrase1 = "SELECT nom,appartement FROM client WHERE status=5 and numclient>0";
$reponse1 = mysql_query($sqlphrase1) or die("Query failed");
while ($val = mysql_fetch_array($reponse1))
{
$nom = $val["nom"];
$appartement = $val["appartement"];
$now= mysql_affected_rows();
switch($now){
case '':
$cools="There is nobody in the Mas de Puech this week.";
break;
default:
$cools="<font color=\"FF0000\">$nom $prenom</font> is in the apartment <font color=\"FF0000\">N°$appartement</font><br>";}
echo "$cools";
}
mysql_free_result($reponse1);
?Merci