An if-statement in a "while(list("

From: Date: Sun, 21 Mar 2004 16:09:15 +0000
Subject: An if-statement in a "while(list("
Groups: php.db 
Request: Send a blank email to php-db+get-33586@lists.php.net to get a copy of this message
Hello I have a search on my page, which presents all the adresses one after all. I would like to present a graphic icon representing the mailaddress, but only when ther IS a mailaddress. Not everyone has a mail address. But I cant put an if-statement in the "while(list(..." Any suggestione to me on showing a graphic with a link when $mail is different from null? Henning Code strip: $searchquery = "SELECT * FROM kontakt WHERE MATCH (navn, telefon, mobil, kommentar) AGAINST ('$search') order by navn"; $searchresult = mysql_query($searchquery); $num = mysql_num_rows ($searchresult); //Hvis der er fundet et resultat: if ($num > 0) { while(list($id, $navn, $telefon, $mobil, $adresse, $postnummer, $bynavn, $kommentar, $mail) = mysql_fetch_row ($searchresult)) print("<p><a href='kontakt/kontakt_edit.php?id=$id'>$navn</a><br> <small><A HREF='mailto:$mail'>$mail</a></small><br> Telefon: $telefon<br> Mobil: $mobil<br> Adresse: $adresse, $postnummer $bynavn<br> <small>$kommentar</small>\n"); } else { echo '<p>Der blev ikke fundet noget, og jeg HAR kigget godt efter!<p>'; }

« previous php.db (#33586) next »