This is a short code from my login function. Im having a problem when trying to get the id from a specific user and indexing it to a new session. The code is commented, hope you guys can help me.
$email = mysql_real_escape_string($_POST['email']);
$password = md5(mysql_real_escape_string($_POST['password']));
include_once("include/connection.php");
$query = "SELECT email,password,id FROM user WHERE email ='".$email."' AND password='".$password."'";
$result = mysqli_query($ligaBD,$query);
$value= mysqli_fetch_array($result);
echo $value['id']; // On this line i get the exact id that i want but if i try to echo this inside "if(mysqli_num_rows($result) == 1) { }" its like the value variable does not exist
if(mysqli_num_rows($result) == 1) {
session_start();
echo $value['id']=$_SESSION['id'];exit; // Getting this error -> "Notice: Undefined index: id"
header("Location: ./cpanel/#welcome");
}