Forum Moderators: coopster
This is my current code (checking to see if image urls supplied by a third party actually exist or not):
$sql="SELECT id, imageX FROM net_hotels LIMIT 1000";
$load_images=mysql_query($sql) or die("Sorry - an error occured. Please check back later.".mysql_error());
$images_found=mysql_num_rows($load_images);
$counter=0;
while ($counter<$images_found)
{
$image=mysql_result($load_images,$counter,"imageX");
$id=mysql_result($load_images,$counter,"id");
if (@fclose(@fopen("$image", "r")))
{
// image is found
echo "$id<br>";
}
else
{
// image is not found - display its id and url
echo "<a href='$image' target='_blank'>$id = $image</a><br>";
}
$counter=$counter+1;
}
?>
As you can see I've even tried to display the id of successfully found images just to try to give the server enough to send to the browser - but nothing happens.
Only when I change:
echo "$id<br>";
To:
echo "<br><a href='$image' target='_blank'>found $image!</a><br>";
does the page start displaying things - and all I really want is to display the "not found" cases.
Any suggestions on how this can be fixed (without adding in an extra field in the table)?
I even tried redirecting the page to itself and incrementing the id field each time - but that stops working after a few iterations too.
Thanks