简体   繁体   English

我的SQL代码似乎没有连接到我的服务器。 它曾经做到过,并且可以在我的Wamp服务器上使用

[英]My SQL code doesn't seem to be connecting to my server. It used to do it and it works on my Wamp server

This is my code: 这是我的代码:

$sql = "INSERT INTO `users` (username,password,email) VALUES('$username','$password','$email')";

$registerquery = mysqli_query($link, $sql);

if($registerquery) {
    $_SESSION['username'] = $username;
    $_SESSION['email'] = $email;
    $_SESSION['logged_in'] = 1;
}

It stops working as it gets to the if($registerquery) line. 到达if($registerquery)行时,它停止工作。

It works on my WAMP server and it was working fine until recently but now all of a sudden it has stopped. 它可以在我的WAMP服务器上正常运行,直到最近都运行良好,但现在突然停止了。 Has anyone got any idea why this is happening? 有谁知道为什么会这样?

Check the SQL Connection (sql_connect) to your server. 检查与服务器的SQL连接(sql_connect)。

If it works on your Wamp Server but not on your main server then it means that either of these have changed: 如果它在您的Wamp Server上可用,但在主服务器上不可用,则意味着这两个都已更改:

  • Server Address 服务器地址
  • Server Login Username 服务器登录用户名
  • Server Login Password 服务器登录密码
  • Access to the database server over http (security change) 通过http访问数据库服务器(安全性更改)

Rectifying either or all of these will solve the issue. 纠正任何一个或所有这些将解决问题。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM