Código PHP:
<?php
$conn = mysql_connect("localhost", "root", "")or die(mysql_error());
$selectDB = mysql_select_db("database")or die(mysql_error());
$query = mysql_query("SELECT * FROM table");
$count = 0;
while($data = mysql_fetch_array($query)){
if($count == "4"){
echo "<br />";
$count = 0;
}
echo "<img src='".$data["img_link"]."' alt='' />";
$count++;
}
?>
Saludos bulter