I have two tables, one for login and password, and one for user data such as address, phone, etc.
After signing in I would like the data displayed on the screen not to be the login, but the person's name, with a telephone address.
The session code is this, I'm using two tables in mysql.
session_start();
$message="";
if(count($_POST)>0) {
$conn = mysql_connect("localhost","root","");
mysql_select_db("users",$conn);
$result = mysql_query("SELECT * FROM users WHERE user_name='" .
$_POST["user_name"] . "' and password = '". $_POST["password"]."'");
$row = mysql_fetch_array($result);
if(is_array($row)) {
$_SESSION["user_id"] = $row[user_id];
$_SESSION["user_name"] = $row[user_name];
} else {
$message = "Login e Senha Invalidos!";
}
}
if(isset($_SESSION["user_id"])) {
header("Location:painelcontrol.php");
}
?>