daveoffy Posted December 1, 2008 Share Posted December 1, 2008 First off my task is to fetch a 5 digit number from my database that got uploaded when users upload a picture so the picture name is in the database. $row = mysql_fetch_array("SELECT picture_id from picture WHERE member_id = '{$_SESSION['SESS_MEMBER_ID']}'"); $abcd= $row['picture_id']; if (isset($_SESSION['SESS_MEMBER_ID'])) { echo '<img src="/uploads/users/'.$abcd.'">'; } else { BLAH BLAH NOT NEEDED } I have connecting to database right but pulling data I don't. Table is picture, in table there is member_id and picture_id. The picture_id is what I want to display after /users/ so it displays their picture. Any questions about what I am asking just reply. Quote Link to comment https://forums.phpfreaks.com/topic/134976-solved-fetch-data-and-display/ Share on other sites More sharing options...
delickate Posted December 1, 2008 Share Posted December 1, 2008 just change ur Query like $row = mysql_fetch_array("SELECT * from picture WHERE member_id = '{$_SESSION['SESS_MEMBER_ID']}'"); $abcd= $row['picture_id']; if (isset($_SESSION['SESS_MEMBER_ID'])) { echo '<img src="/uploads/users/'.$abcd.'">'; } else { BLAH BLAH NOT NEEDED } Quote Link to comment https://forums.phpfreaks.com/topic/134976-solved-fetch-data-and-display/#findComment-702965 Share on other sites More sharing options...
daveoffy Posted December 1, 2008 Author Share Posted December 1, 2008 That didn't work... I don't know what is going wrong. Quote Link to comment https://forums.phpfreaks.com/topic/134976-solved-fetch-data-and-display/#findComment-702970 Share on other sites More sharing options...
The Little Guy Posted December 1, 2008 Share Posted December 1, 2008 Try this: $sql = mysql_query("SELECT * from picture WHERE member_id = '{$_SESSION['SESS_MEMBER_ID']}'"); $row = mysql_fetch_array($sql); Quote Link to comment https://forums.phpfreaks.com/topic/134976-solved-fetch-data-and-display/#findComment-703009 Share on other sites More sharing options...
daveoffy Posted December 2, 2008 Author Share Posted December 2, 2008 Thanks, it took a little while for me to get it working but I got it. Quote Link to comment https://forums.phpfreaks.com/topic/134976-solved-fetch-data-and-display/#findComment-703605 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.