Checking if file exists not working... why?
Posted: Thu Mar 23, 2017 4:49 am
Code: Select all
<?php
echo "<div class='width-narrow'>";
$count = 0;
$query = ("SELECT id, title, catname, subname, photoprimary FROM products WHERE pause <> 'on' ORDER BY title");
$result = $pdo->query($query);
while ($row = $result->fetch(PDO::FETCH_OBJ))
{
$count ++;
$image = "/images/productphotos/small/$row->photoprimary" . "_475.jpg";
if (file_exists("$image"))
{}
else
{
echo "missing image for $row->title<br/>";
}
}
echo "$count</div>";
?>