therelelogo Posted June 21, 2010 Share Posted June 21, 2010 Hi all (very first post ) Okay, so, I'm making an ebay clone using PHP and MySql (nope, i'm not asking for any help there, almost everything is sorted) but i'm falling down in one key area... the user login name. I'm using a log-in method that i found on the net which seems to work very well, obviously validating the info against a MySql database. heres what happens when the login is executed: //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; $_SESSION['SESS_LOGON_NAME'] = $member['login']; $_SESSION['SESS_TOWN'] = $member['town']; $_SESSION['SESS_COUNTY'] = $member['county']; $_SESSION['SESS_EMAIL'] = $member['email_add']; $_SESSION['SESS_ACC'] = $member['account_type']; obviously thats not the whole code but it's just so you see what the variables are. Now, i can search by most of these fields one way or another EXCEPT the LOGON name, because when i try to search my table like this: $query = "SELECT seller, COUNT(seller) FROM adverts WHERE seller = '****and this is where i fall down***"; if i try entering $_SESSION['SESS_LOGON_NAME'] or $member['login']; i just get an error saying it was expecting a string, now, heres my question: how can i use the above info to search my table by my logon name? i assume i'm going to have to convert it to a string but i cant find any good tips on the net, can anybody help me please ...and i'm still a n00b so please speak english people! lol Quote Link to comment https://forums.phpfreaks.com/topic/205471-session-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 21, 2010 Share Posted June 21, 2010 $query = "SELECT seller, COUNT(seller) FROM adverts WHERE seller = '{$_SESSION['SESS_LOGON_NAME']}'"; Quote Link to comment https://forums.phpfreaks.com/topic/205471-session-help/#findComment-1075250 Share on other sites More sharing options...
therelelogo Posted June 21, 2010 Author Share Posted June 21, 2010 OMG... thank you so much mate, that worked. You have no idea how much that little segment of code has helped me with my site, and how much time and frustration i've spent trying to get it to work. very much appreciated, very very much, i can also use that code to go back and make my site a little better with other scripts now i no how to do it. I have a few other questions, but they can wait till another night, im happy with this. Thanks a million!! Quote Link to comment https://forums.phpfreaks.com/topic/205471-session-help/#findComment-1075256 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.