I'm hosting a Private Server for Geometry Dash. The server itself works just fine. I'm attempting to create a query, however the query seems to "time out" when I run it. Error:
Connection Failure (2002) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I've attempted simple things, such as disabling my firewall, using the IP for the host instead of the link itself, and nothing seems to work.
If you have any ideas why this isn't working, let me know. (don't mind my coding format, it isn't great)
<html>
<head>
<style>
body {background-color: #ddd;}
</style>
</head>
</html>
<?php
$host = "sql.7m.pl";
$dbusername = "db-user21496";
$dbpassword = "(censored)";
$dbname = "db-user21496";
$username = filter_input(INPUT_POST, 'username');
$userCoins = filter_input(INPUT_POST, 'userCoins');
if (!empty($username)){
//Creates a connection:
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
// Error testing and reporting:
if(mysqli_connect_error()){
die('Connection Failure (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
} else {
// UPDATE/EDIT TABLE
$sql = "UPDATE users SET userCoins='$userCoins' WHERE username='$username'";
if ($conn->query($sql)){
echo "userCoins has been set to ".$userCoins.".";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
// CLOSE CONNECTION
$conn->close();
}
//EMPTY FIELD REPORTING
} else {
echo "Username should not be empty!";
die();
}
?>
The script should connect to the server and update the variable userCoins from the table users. Instead, it doesn't even connect and it just times out.