So i want to connect mysql to my site i created a database and from cpanel got all the data needed but when i run the code it says that password or username incorrect
sensitive details exposed
what do you mean unlisted i had hidden the pass or you want to say that the name of db and the username is sesitive?
Please reset your hosting account password
I changed pass but still dosent work
You need to enter your actual database name, not “db_name”. Create a database under “MySQL” in the control panel
I tried to delete the database and to create it again with the name if0_36670334_phplogin but it still didnt work
I just checked it and as far as I can tell it just works. If I try to access the script your shared on your website, it says “Please fill both the username and password fields!”. Which means the connection has already been established successfully.
Can you share a URL on your website where we can see this error?
Here is the link to website
To test it i tried to clean cache and to use an other browser but it was giving me the } else { // Incorrect password echo 'Incorrect username and/or password!'; } } else { // Incorrect username echo 'Incorrect username and/or password!'; }
or in short 'Incorrect username and/or password!'
witch it is saying that it could not connect i made a video to show evrey step i took:https://www.youtube.com/watch?v=NyuDHHTQDSQ
This is expected.
Your username does not match
Maybe your password is wrong as well?
It is indeed the expected behaviour
Looking at the code you shared before, the message Incorrect username and/or password
is an error message you generate yourself in your code. If you follow the code, you will see that this is the error message printed if no user can be found with the given username (checked at line 26), which generates this message (via line 45).
The only situation in the code where it redirects to another page if the login is successful (line 38). But your video very clearly shows a different username being used, so of course you will not hit that success condition.
In short, your code seems to be doing exactly what it’s supposed to do. If you want people to be redirected on an unsuccessful login, then you will need to write code for that yourself.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.