max_w1 Posted February 1, 2008 Share Posted February 1, 2008 i have a page which displayes the users image form the database.. i know the sql query for this buy it is not working!! can anyone help me pleeeese.... the code i am using is: $a = mysql_query ("SELECT `avatar` FROM `users` WHERE `username` = '$welcome'") or die(mysql_error()); print " $a "; but the output i am getting is: Resource id #7 Quote Link to comment Share on other sites More sharing options...
Illusion Posted February 1, 2008 Share Posted February 1, 2008 You need to use mysql functions in PHP to fetch the results. like mysql_fetch_assoc() Quote Link to comment Share on other sites More sharing options...
max_w1 Posted February 1, 2008 Author Share Posted February 1, 2008 how do i use that ???? can you give me an example??? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 1, 2008 Share Posted February 1, 2008 <?php $result = mysql_query ("SELECT `avatar` FROM `users` WHERE `username` = '$welcome'") or die(mysql_error()); $user = mysql_fetch_assoc($result); print $user['avatar']; ?> Quote Link to comment Share on other sites More sharing options...
max_w1 Posted February 1, 2008 Author Share Posted February 1, 2008 yes!!! i finally sorted out the problem; i had actually mentioned $welcome veriable below the Sql query thats why it was not reading any info... 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.