mike12255 Posted January 27, 2009 Share Posted January 27, 2009 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 }?> Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/ Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-747999 Share on other sites More sharing options...
mike12255 Posted January 27, 2009 Author Share Posted January 27, 2009 still not showing an image :-\ Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748005 Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 It will say something then, what does it say? Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748006 Share on other sites More sharing options...
Sudden Posted January 27, 2009 Share Posted January 27, 2009 <img src= <?=$image?> /> should probly read <img src= <?php $image ?> /> Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748007 Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 No it shouldn't <?="anything"?> The above requires short tags to be on is like doing <?php echo "anything";?> Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748008 Share on other sites More sharing options...
Prismatic Posted January 27, 2009 Share Posted January 27, 2009 change $findimage = mysql_query ("Select * FROM `phpbb_files`"); to $findimage = mysql_query ("Select * FROM `phpbb_files`") or die(mysql_error()); and see if anything is displayed Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748016 Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 Going on that idea also add echo mysql_num_rows($findimage); under the query to see how many rows it finds Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748021 Share on other sites More sharing options...
mike12255 Posted January 27, 2009 Author Share Posted January 27, 2009 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\" />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748026 Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748027 Share on other sites More sharing options...
mike12255 Posted January 27, 2009 Author Share Posted January 27, 2009 it said: 1 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sgiclan/public_html/gnomes/images.php on line 469 Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748029 Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 I changed the code Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748031 Share on other sites More sharing options...
mike12255 Posted January 27, 2009 Author Share Posted January 27, 2009 crap its back to saying nothing, its suposed to appear under the video player: http://sgi-clan.info/gnomes/images.php Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748035 Share on other sites More sharing options...
DeanWhitehouse Posted January 27, 2009 Share Posted January 27, 2009 It is , from your source code <td width="546"><img src="./uploads/1233033668.gif" alt="Image can not be found" /> </td> Near the bottom Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748039 Share on other sites More sharing options...
mike12255 Posted January 27, 2009 Author Share Posted January 27, 2009 I just recreated the database and it appears to be working Quote Link to comment https://forums.phpfreaks.com/topic/142704-solved-image-not-appeaaring/#findComment-748051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.