Jump to content

Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\POS SYSTEM\2. User Module\controllers\users.controller.php on line 29


Glindet
 Share

Recommended Posts

hello pls i have been facing this error for days now . can someone help me to fix it. the bold line is the one having the warning message.

if($answer["username"] == $_POST["loginUser"] && $answer["password"] == $encryptpass)

                {

                    $_SESSION["loggedIn"] = "ok";

                    $_SESSION["id"] = $answer["id"];

                    $_SESSION["name"] = $answer["name"];

                    $_SESSION["username"] = $answer["username"];

                    $_SESSION["picture"] = $answer["picture"];

                    $_SESSION["profile"] = $answer["profile"];              

                    echo '<script>

                        window.location = "home";

                         </script>';

                }

                else

                {

                    echo '<br><div class="alert alert-danger">User or password incorrect</div>';

 

                }

Link to comment
Share on other sites

The error is complaining that you're trying to treat a boolean value as if it were an array.

There are two variables on that line. One of them is $_POST. I really hope you don't have code that somehow turns it into a boolean. The other variable is $answer...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.