Kev0121
03-20-2009, 08:19 PM
Right, this is gonna be abit confussing and hard to explain but here we go.
I'm trying to create a usercp, and i need to get the users ID when they login, to do this im setting a session when they login heres the bit of code..
if(mysql_num_rows($que) == 1)
{
$_SESSION['loggedin'] = 1;
$_SESSION['username'] = $_POST['username'];
header("Location: usercp.php");
}else
and then i try and call it in my usercp.php with this bit of code
$sql = "SELECT `id` WHERE"
."`username` = '$username'"
."AND `password` = '$password'";
$res = mysql_query($sql);
$username = $_SESSION['username'];
then i would do
<?php echo $username; ?>
but doesnt echo the username, it echo's nothing at all and i really dont know why maybe some can explain and help me!
Thanks, Kevin
I'm trying to create a usercp, and i need to get the users ID when they login, to do this im setting a session when they login heres the bit of code..
if(mysql_num_rows($que) == 1)
{
$_SESSION['loggedin'] = 1;
$_SESSION['username'] = $_POST['username'];
header("Location: usercp.php");
}else
and then i try and call it in my usercp.php with this bit of code
$sql = "SELECT `id` WHERE"
."`username` = '$username'"
."AND `password` = '$password'";
$res = mysql_query($sql);
$username = $_SESSION['username'];
then i would do
<?php echo $username; ?>
but doesnt echo the username, it echo's nothing at all and i really dont know why maybe some can explain and help me!
Thanks, Kevin