<?php


                $user= $_SESSION['user_email'];
                $get_user = "select * from users where user_email='$user'";
                $run_user = mysqli_query($con, $get_user);
                $row = mysqli_fetch_array($run_user);

This is my php code and at "$user= $_SESSION['user_email'];", it shows the notice of undefined index in user_email.
How do I fix it? I already tried to put if(isset()) for the above line but nothing changes.
Please suggest something to resolve this error.

    Outside of some sort of typo, I don't know why an isset($_SESSION['user_email']) wouldn't trap it.

    dalecosp
    Good question: I'm not sure if you'd get an index not set error in that case, or an undefined variable warning?

    NogDog no not an undefined variable warning its undefined index

      Well then, maybe the next step is a bit of temporary debug code to see if that points to anything obvious to you:

      if(!isset($_SESSION['user_email'])) {
        die("<pre>DEBUG -- No user_email:\n".print_r($_SESSION, 1)."</pre>");
      }
      

      🙂

        Write a Reply...