Fatal error: Uncaught mysqli_sql_exception

Website URL

https://internet-diving.infinityfreeapp.com/

Error Message

Fatal error : Uncaught mysqli_sql_exception

Other Information

The error reads:


Fatal error: Uncaught mysqli_sql_exception: Connection refused in /home/vol7_3/infinityfree.com/if0_36011463/htdocs/index.php:10 Stack trace: #0 /home/vol7_3/infinityfree.com/if0_36011463/htdocs/index.php(10): mysqli->__construct('127.0.0.1', 'fighter', Object(SensitiveParameterValue), 'fighter') #1 {main} thrown in /home/vol7_3/infinityfree.com/if0_36011463/htdocs/index.php on line 10

Line 10 currently reads

$mysqli = new mysqli($servername, $username, $password, $database);

I have tried replacing the details with the actual details. But I always come back to this

Show the values you are entering for everything except password

3 Likes

There you have it

Please read

7 Likes

I have tried this, and get the below error instead

Fatal error : Uncaught mysqli_sql_exception: Connection refused in /home/vol7_3/infinityfree.com/if0_36011463/htdocs/index.php:10 Stack trace: #0 /home/vol7_3/infinityfree.com/if0_36011463/htdocs/index.php(10): mysqli->__construct(‘127.0.0.1’, ‘fighter’, Object(SensitiveParameterValue), ‘fighter’) #1 {main} thrown in /home/vol7_3/infinityfree.com/if0_36011463/htdocs/index.php on line 10

The error clearly shows that the database hostname and username are incorrect. Maybe the password is too, but we can’t tell.

Please make sure to use the right connection settings for your database. You can find them on the MySQL Databases pages for your account in the client area.

3 Likes

Well, it’s the only database in phpmyadmin

Unless it’s because nowhere in the code does it say which table the data is meant to go into

Again:

Of course the database works in phpMyAdmin. That’s because phpMyAdmin uses the correct connection settings. Your code very clearly does not.


In case it’s not clear:

This tells me you are using the database hostname 127.0.0.1, username fighter and database name fighter. All of those cannot be correct. Please check the client area for the right settings to use.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.