Hi, I'm using some code I found in the archives,
session_start();
if (@$user_name && @$password) {
$res = @("SELECT user_id FROM table WHERE user_name='$user_name' AND password='". md5($password) ."'");
if(@mysql_num_rows($res) != 0) {
$sUserID = "$user_id";
session_register("sUserID");
}
}
So users login, with user_name & password, then the database gets their user_id. However the above code does not work, I'm not sure if its pulling the user_id field out correctly, and registering it! Can anyone see why?
I can get it to register the user_name with
session_start();
$sUserID = "user_name";
session_register("sUserID");
Many thanks
Ben