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! Quote Link to comment Share on other sites More sharing options...
Lumio Posted June 18, 2007 Share Posted June 18, 2007 Where did you save the pictures? Quote Link to comment 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" />'; ?> Quote Link to comment 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! Quote Link to comment 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.