Jump to content

[SOLVED] Image not appeaaring


mike12255

Recommended Posts

I created some code to grab and image from X folder and by X name (both combined into one var called $image) i get no errors when i view the page, but the images don't appear. I tried echoing $name and it showed up properly as uploads/image.gif

 

heres my code :

 

<?php   
    
    $findimage = mysql_query ("Select * FROM `phpbb_files`");

while ($row = mysql_fetch_array($findimage)){
$image ="uploads/"; 
$image .= $row['shortname'];


?>
<img src= <?=$image?> />

<?php }?>

Link to comment
https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/
Share on other sites

<?php   
    error_reporting(E_ALL);
    $findimage = mysql_query ("Select * FROM `phpbb_files`");
   
   while ($row = mysql_fetch_array($findimage)){
   $image ="./uploads/"; 
   $image .= $row['shortname'];

echo "<img src=\"".$image."\"  alt=\"Image can not be found\" />";
}
?>

Try that

I tried what you mates suggested so i've been editing it, and got the following error:

 

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sgiclan/public_html/gnomes/images.php on line 466

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sgiclan/public_html/gnomes/images.php on line 467

 

<?php   
    error_reporting(E_ALL);
   $findimage = mysql_query ("Select * FROM `phpbb_files`") or die(mysql_error());
   echo mysql_num_rows($findimage['shortname']);
   while ($row = mysql_fetch_array($findimage['shortname'])){
   $image ="uploads/"; 
   $image .= $row['shortname'];

echo "<img src=\"".$image."\"  alt=\"Image can not be found\" />";
}
?>

What the hell, is that your code?

 

Do this

<?php   
    error_reporting(E_ALL);

   $findimage = mysql_query ("Select * FROM `phpbb_files`") or die(mysql_error());
   echo mysql_num_rows($findimage);

   while ($row = mysql_fetch_array($findimage)){
   $image ="uploads/"; 
   $image .= $row['shortname'];

echo "<img src=\"".$image."\"  alt=\"Image can not be found\" />";
}
?>

And tell us what it says

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.