andreasb Posted February 28, 2010 Share Posted February 28, 2010 Hello, Right now I'm having a hard time fetching rows via sessions. Let's say that I have a session: $_SESSION['username'] Now I log in with username "Andreas". Now I want to fetch the my "Points" count. It looks like this: How can I fetch that info by using my USERNAME session? Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/ Share on other sites More sharing options...
teamatomic Posted February 28, 2010 Share Posted February 28, 2010 $username=$_SESSION['username']; SELECT * FROM users WHERE username= $username HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/#findComment-1019579 Share on other sites More sharing options...
jl5501 Posted February 28, 2010 Share Posted February 28, 2010 more specifically "SELECT * FROM users WHERE username= '$username'" Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/#findComment-1019583 Share on other sites More sharing options...
andreasb Posted February 28, 2010 Author Share Posted February 28, 2010 And how exactly will this make me able to do this? echo $points; This did not work, and I'm not sure how to use your replies for what I want to do. $username = $_SESSION['username']; $points = "SELECT * FROM members WHERE username=$username"; Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/#findComment-1019585 Share on other sites More sharing options...
Dennis1986 Posted February 28, 2010 Share Posted February 28, 2010 Maybe you should read this: http://www.w3schools.com/PHP/php_mysql_where.asp Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/#findComment-1019588 Share on other sites More sharing options...
jl5501 Posted February 28, 2010 Share Posted February 28, 2010 you must have your $username in its own quotes Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/#findComment-1019593 Share on other sites More sharing options...
andreasb Posted February 28, 2010 Author Share Posted February 28, 2010 you must have your $username in its own quotes That solved everything! Thanks bunch ! Link to comment https://forums.phpfreaks.com/topic/193696-session-question-fetch-user-rowstables/#findComment-1019597 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.