Resource for WHMCS MySQL database connection
There may be a time when you need to know the database resource variable for the default WHMCS MySQL connection. This variable is named $whmcsmysql, below is a quick example of how to use it.
global $whmcsmysql; $query = sprintf("SELECT * FROM tblclients WHERE id = %d", $_REQUEST['id']); $result = mysql_query($query, $whmcsmysql); if($result === false) die('Query Failed: ' . mysql_error()); $client = mysql_fetch_assoc($result); if(!is_array($client)) die("No client found with id " . $_REQUEST['id']);