Laurens Mäkel Laurens Mäkel - 2 months ago 24
MySQL Question

PHP Session() nothing stored?

So, I have this file login.php which should set the session["uid"] to the matching user_id out of the database. I am sure the login works because the javascript below is only executed when I enter valid login info... Sadly the uid is not set and I cannot use

<?php echo $_SESSION["uid"]; ?>

to echo out the users uid...

This is my code


$connect = mysqli_connect('localhost', 'buyc_com_webstor', 'password', 'buycheapvaporizer_com_webstor');

$email = $POST["userEmail"];
$password = md5($_POST["userPassword"]);
$sql = "SELECT * FROM user_info WHERE email = '$email' AND password = '$password'";
$run_query = mysqli_query($connect,$sql);
$count = mysqli_num_rows($run_query);
if($count = 1){
$row = mysqli_fetch_array($run_query);
$_SESSION["uid"] = $row["user_id"];
$_SESSION["name"] = $row["first_name"];
echo "





if($count = 1){ should be if($count == 1){

Single = is setting the variable, double == is checking the variable.