gpt4 book ai didi

php - 用户 co_p 已经有超过 'max_user_connections' 个事件连接

转载 作者:行者123 更新时间:2023-11-29 02:13:32 25 4
gpt4 key购买 nike

我有一个 PHP 代码可以从一个大文本文件中插入一些信息在文件的开头我有这段代码:

<?php
$host = "localhost";
$username = "user";
$password = "pass";
$db = "dbname";

mysql_connect($host,$username,$password) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
mysql_close;

set_time_limit(0);

$fh = fopen("file.txt", "r");
while ($row = fgets($fh)) {
//// CODE ....
mysql_query("INSERT IGNORE INTO `TABLE` VALUES (NULL, '$ETC', '$ETC', '$ETC')");
}
fclose($fh);
?>

但是在一些 iserts 之后我得到了这个错误:

Warning: mysql_connect(): User co_p already has more than 'max_user_connections' active connections in /home/username/public_html/file.php on line 7 User co_p already has more than 'max_user_connections' active connections

这个问题有什么解决办法吗?

  • 我是服务器的所有者!

最佳答案

mysql_close; 

应该会产生错误。

这个命令应该是

mysql_close();

Add error reporting to the top of your file(s) while testing right after your opening PHP tag for example <?php error_reporting(E_ALL); ini_set('display_errors', 1); to see if it yields anything.

But I have to ask, why are you connecting to the database and then closing the connection straight after?

添加更多代码后。

因为您实际上是在尝试访问数据库,所以您不想执行 mysql_close();你在哪里编码的。

但我必须补充:

Every time you use the mysql_ database extension in new code this happens it is deprecated and has been for years and is gone for ever in PHP7. If you are just learning PHP, spend your energies learning the PDO or mysqli database extensions and prepared statements. Start here

关于php - 用户 co_p 已经有超过 'max_user_connections' 个事件连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45143445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com