php - display profile page after login using PDO -
I am using code to create login page, but after login, I will be redirected to home page To see the I dashboard, but with this I am also receiving these 2 errors
1) Warning: PDOStatement :: execute () [pdostatement.execute]: SQLSTATE [HY093]: invalid Parameter number: parameter was not defined
2) Warning: header information can not be modified - header initiatives The only sent
Sessions page, these errors are coming.
session.php
& lt ;? Php $ dbhost = "localhost"; $ Dbname = "abc"; $ Dbuser = "abc"; $ Dbpass = "PWD"; $ Conn = new PDO ("mysql: host = $ dbhost; dbname = $ dbname", $ dbuser, $ dbpass); Session_start (); $ User_check = $ _ session ['login_user']; $ Result = $ conn- & gt; Prepare ("Select SELECT * FROM WHERE Email =: user_check"); $ Result-> Execute (array (": usercheck" => $ user_check)); $ Line = $ result- & gt; Obtain (PDO :: FETCH_ASSOC); $ Login_session = $ line ['email']; $ User_id = $ line ['id']; $ User_passwords = $ line ['password']; If (! Isset ($ login_session)) {$ conn = null; Header ('location: login_form.html'); }? & Gt; Can anyone explain how these errors can be removed? When I am changing: $ user_check to: user_check or the usercheck in the query (according to the next array description also changes) the login page is being redirected to the dashboard, instead it is re-login page Moving on.
Due to being suspicious, the first error causes a typo.
$ result = $ conn- & gt; Ready ("SELECT * FROM register WHERE email =: $ user_check"); $ Result-> Execute (array (": usercheck" => $ user_check));
should be
$ result = $ conn- & gt; Prepare ("SELECT SELECT * FROM WHERE Email =: User Check"); $ Result-> Execute (array (": usercheck" => $ user_check));
Your other error is likely because you have the
Comments
Post a Comment