0) { while ($ph = mysql_fetch_assoc($rezSelectPhoto)) { $sqlDeletePhoto = "DELETE FROM object_photo where id = $ph[object_photo_id]"; mysql_query($sqlDeletePhoto); $sqlDeletePhotoLinks = "DELETE FROM objects_object_photo where id = $ph[id]"; mysql_query($sqlDeletePhotoLinks); } } } }