Home >Backend Development >PHP Tutorial >How can I know which database is currently being used using code? , current database_PHP tutorial

How can I know which database is currently being used using code? , current database_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-12 09:03:30929browse

How to know which database is currently being used using code? , current database

One day, an error suddenly occurred in the production environment. The exception thrown was probably that a certain table did not exist. I thought at the time why it did not exist? Could it be that it was attacked by hackers? So I want to know which database is currently used

<span>$current_database</span> = <span>mysql_query</span>("SELECT DATABASE()") or <span>die</span>(<span>mysql_error</span>());<br /><span>echo</span> <span>mysql_result</span>(<span>$current_database</span>,0);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1080768.htmlTechArticleHow to use code to know which database is currently being used? , the current database. One day, an error suddenly occurred in the production environment. The exception thrown was probably that a certain table did not exist. I was...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn