dousha7904 2019-05-09 00:47
浏览 77

第三方SQL查询超时,即使服务器完全没问题?

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题