Just use mysql_query (or mysqli_query, even better, or use PDO, best of all) with:
SELECT DATABASE() FROM DUAL;
Addendum:
There is much discussion over whether or not FROM DUAL
should be included in this or not. On a technical level, it is a holdover from Oracle and can safely be removed. If you are inclined, you can use the following instead:
SELECT DATABASE();
That said, it is perhaps important to note, that while FROM DUAL
does not actually do anything, it is valid MySQL syntax. From a strict perspective, including braces in a single line conditional in JavaScript also does not do anything, but it is still a valid practice.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…