i am trying to register 2 sessions. one is supposed to get the id of the user logging in, the other is supposed to get the persons username. here is the login page:

include "dbconnect.php";


$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE email='$myusername' AND password='$mypassword'";


$result = mysql_fetch_assoc ($resID);

$_SESSION['myusername'] = $result['username'];
$_SESSION['uid'] = $result['id'];
else {
echo "Wrong Username or Password";

and the members.php page:

include "dbconnect.php";
$id = $_SESSION['uid'];
$username = $_SESSION['myusername'];

the sessions are not registering and will not work.
if anybody could please help that would be awesome

what php version are you using?

when you start a session be careful because it my not be closed in it is still open.
you have two session at the start of each code so you have to kill the actions of both.
use this in a new php tag
so you are directly omitting the affect of each action

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.