/ Published in: PHP
If the image source is not in the database a default image is displayed.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Retrieves data from MySQL $data = mysql_query("SELECT * FROM db*****") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { ?> <div class="member"> <div class="imageSection"> <? if($info['photo'] == '') {echo "<img class=\"memberImage\" src=images/default.jpg>";} else {echo "<img class=\"memberImage\" src=images/".$info['photo'] .">";} ?> </div> </div>