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:

<?php
session_start();
include "dbconnect.php";

$myusername=$_POST['user'];
$mypassword=$_POST['pass'];

$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'";
$resID=mysql_query($sql);

$count=mysql_num_rows($resID);

if($count==1){
$result = mysql_fetch_assoc ($resID);

$_SESSION['myusername'] = $result['username'];
$_SESSION['uid'] = $result['id'];
header('location:memberspage.php');
}
else {
echo "Wrong Username or Password";
}
?>

and the members.php page:

<?php
session_start();
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
$_session(die);
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.