When I go to Localhost and try the username and the password it tells me that is an error? why?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
It looks entered username/password or both are not matching with the database table my_db.
Reasons : Localhost means the db is getting refereed in local. So in your local database under my_db table there is no user exists with the given username and password. May be that data is valid in remote database server.
Solution : 1. Take a dump from remote database and put in your localhost so that your local db and remote db are replica 2. For simple solution, just insert the required details in my_db table.
Hope that helps
1) Use password_hash docs
while registration use
password_hash()
to hash the password and store it in database and while login usepassword_verify()
to verify the password like this .2) user prepared statement to avoid sql injection