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