Hi. I'm looking to set up some simple code that sent data submitted on a forms to a database on a website and it's not so simple! I thought I'd start with doing it on a local server then move that to online but I keep running in to an error.
I' tried to set up a simple html->php->MySQL page using the code here:
https://www.raghwendra.com/blog/how-to-connect-html-to-database-with-mysql-using-php-example/
unfortunately when submitting form data to test I get the following error message
"Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\contact\contact.php:5 Stack trace: #0 C:\xampp\htdocs\contact\contact.php(5): mysqli_connect('localhost', 'root', Object(SensitiveParameterValue), 'db_contact') #1 {main} thrown in C:\xampp\htdocs\contact\contact.php on line 5"
I also tried setting up a simple html->php->MySQL page using the code on
https://www.webcodzing.com/connect-html-form-to-mysql-database-using-php/
which is much the same but with the database being password protected. That time I got the following error code:
Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'formdb_user'@'localhost' (using password: YES) in C:\xampp\htdocs\testsite\form.php:22 Stack trace: #0 C:\xampp\htdocs\testsite\form.php(22): mysqli_connect('localhost', 'formdb_user', Object(SensitiveParameterValue), 'form_entriesdb') #1 {main} thrown in C:\xampp\htdocs\testsite\form.php on line 22
How do I resolve this? I'm finding this all very frustrating and just want to know how to fix it. Thank you!!