Bu neden çalışmaz
veri varsa çalışıyor veri yoksa çalışmıyor.
$sqls = mysqli_query("SELECT att_id, att_path, att_img, att_item
FROM att_tablo WHERE att_item = '5' ORDER BY att_id DESC");
while($row = mysqli_fetch_array($sqls))
{
$resimvar = "<img style=\"padding:2px; width:505px; height:300px;\" class=\"img-fluid\" src=\"".$row['att_path']."\" />";
$resimyok = "<img style=\"padding:2px; width:505px; height:300px;\" class=\"img-fluid\" src=\"img/bos.png\" />";
if ($row['att_item'])
{$item .= $resimvar;}
else
{$item .= $resimyok;}
}
while döngüsünün içinde sorgulama yaptığın için döngüye girmiyor olabilir, if sorgunu while dışına alırsan düzelebilir