wrathican Posted August 9, 2007 Share Posted August 9, 2007 hey guys im trying to echo a single value from my db, the problem is, it's not working. heres my code: $query = "SELECT img_thumb FROM port_image WHERE img_proj_id='" . $id . "' AND img_title='Y'"; $result = mysql_query($query); $pic = mysql_fetch_array($result,MYSQL_NUM); //echo the output echo "<img src='" . $pic[2] . "'>"; ?> when i put my query into phpMyadmin it works and brings up the right value. i guess im just echoing it wrong. Link to comment https://forums.phpfreaks.com/topic/64052-solved-echoing-a-single-value-from-a-database-not-working/ Share on other sites More sharing options...
jitesh Posted August 9, 2007 Share Posted August 9, 2007 check echo "<pre>"; print_r($pic); echo "<img src='" . $pic[0] . "'>"; Link to comment https://forums.phpfreaks.com/topic/64052-solved-echoing-a-single-value-from-a-database-not-working/#findComment-319252 Share on other sites More sharing options...
wrathican Posted August 9, 2007 Author Share Posted August 9, 2007 thanks alot. i just realised that i was echoing $pic[2], not $pic[0].there wasnt 3 values in the array there was only one... thanks man! Link to comment https://forums.phpfreaks.com/topic/64052-solved-echoing-a-single-value-from-a-database-not-working/#findComment-319254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.