Using Session ID's for tracking purposes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BigMC22
Forum Newbie
Posts: 5
Joined: Sun Mar 07, 2004 1:33 pm

Using Session ID's for tracking purposes

Post by BigMC22 »

Hello,
I am new to the boards and need some help. Here is what I am trying to do, and not having much luck finding the answer on my own:

-User signs up and a member ID is stored in a MySQL database
-When they login to my site I would like that person's member ID to be used as the session ID
-I also need that ID to be added to all clickable URL's and banners on the site for tracking purposes

What is the best way to do this. I would imagine it has something to do with using SID as a place holder in the URL's but does this work and how do I get the SID to be what the user's member ID is?

Any help would be greatly appreciated.

Thanks.
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

Code: Select all

<?php
session_start();
$_SESSION['Session_name'] = $memberid;
?>
BigMC22
Forum Newbie
Posts: 5
Joined: Sun Mar 07, 2004 1:33 pm

Post by BigMC22 »

Thanks...Is there anything I need to add to have the $memberid pull from the database for that user when they login? say the database table is called member_info...Thanks again for the help.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

$sql = "SELECT memberid FROM member_info WHERE username = '$username'";
$memberid = mysql_result(mysql_query($sql), 0,0);
Post Reply