php mysql_connect resource is allways the same

邮差的信 提交于 2019-12-05 19:21:36

You've managed to omit all the relevant code, but many database extensions in PHP reuse currently open connections unless you specifically instruct them not to do so. If you are using mysql_connect(), have a look at the $new_link parameter:

mysql_connect — Open a connection to a MySQL Server
Report a bug
Description
resource mysql_connect ([ string $server = ini_get("mysql.default_host") [, string $username = ini_get("mysql.default_user") [, string $password = ini_get("mysql.default_password") [, bool $new_link = false [, int $client_flags = 0 ]]]]] )

Opens or reuses a connection to a MySQL server.

.

new_link

If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The new_link parameter modifies this behavior and makes mysql_connect() always open a new link, even if mysql_connect() was called before with the same parameters. In SQL safe mode, this parameter is ignored.

Are you using sql.safe_mode (check your configuration files)? The documentation for mysql_connect indicates that *new_link* is ignored in such cases.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!