Jump to content

$SESSION help :(


therelelogo

Recommended Posts

Hi all (very first post  :P)

 

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  :P

 

 

Link to comment
Share on other sites

:o 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!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.