PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
simonmlewis
DevNet Master
Posts: 4435 Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:
Post
by simonmlewis » 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>";
?>
This just shows a load of "missing image" rows. Even tho most files are there.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
pbs
Forum Contributor
Posts: 230 Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:
Post
by pbs » Thu Mar 23, 2017 5:44 am
Print the below line and check if you get its path correct.
Code: Select all
echo $image = "/images/productphotos/small/$row->photoprimary" . "_475.jpg";
Celauran
Moderator
Posts: 6427 Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada
Post
by Celauran » Thu Mar 23, 2017 6:12 am
Use an absolute path instead.