query("SET NAMES 'utf8'"); $query = 'SELECT * FROM `x_arenda` WHERE id="' . $_GET['d'] . '" LIMIT 1' or die("Error in the consult.." . mysqli_error($link)); $res_i = mysqli_query($link, $query); while($rom=mysqli_fetch_array($res_i)) { $i2 = $_GET['i']+1; $img = "images/" . $rom["dir"] . "/" . $rom["img"] . "_" . $i2 . ".jpg"; if (file_exists($img)) echo ""; else echo ""; echo " "; } mysqli_free_result($res_i); ?>