Joefunkx Posted June 18, 2007 Share Posted June 18, 2007 I am using php to perform a query on a mysql table and then display the results on a page. Next to each result, i want to be able to display an image that pertains to that specific result. I do not want to upload the images into the table due to space issues. Essentially, each result will have a 5 digit id variable that i am trying to name the images. So, for example, result a will have id 11111 so it would link to image 11111.jpg, result b will have id 22222, so it would link to image 22222.jpg. I tried the following without any luck- <IMG SRC="<?yourfield?>.jpg"> where yourfield is equal to the 5 digit number mentioned above.. the only thing i get when the page is displayed is an empty image that is trying to point to ".jpg". Any thoughts on this? Thanks guys! Link to comment https://forums.phpfreaks.com/topic/56096-solved-can-i-open-an-image-this-way/ Share on other sites More sharing options...
Lumio Posted June 18, 2007 Share Posted June 18, 2007 Where did you save the pictures? Link to comment https://forums.phpfreaks.com/topic/56096-solved-can-i-open-an-image-this-way/#findComment-277044 Share on other sites More sharing options...
Caesar Posted June 18, 2007 Share Posted June 18, 2007 Before trying to display your image, you need to debug your code/php to make sure you're pulling the value correctly from the database. You also need to make sure you're specifying the correct image path. <?php $query = $db->query("SELECT * FROM usrinfo WHERE id = '$id'"); $usrinfo = $db->fetch_array($query); echo'<img src="images/'.$usrinfo[uid].'jpg" alt="image info" />'; ?> Link to comment https://forums.phpfreaks.com/topic/56096-solved-can-i-open-an-image-this-way/#findComment-277045 Share on other sites More sharing options...
Joefunkx Posted June 18, 2007 Author Share Posted June 18, 2007 Thanks, I tweaked that a bit and it works great! Link to comment https://forums.phpfreaks.com/topic/56096-solved-can-i-open-an-image-this-way/#findComment-277073 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.