WHMCS native select_query function

There’s no reason to explain why do we need to make SQL queries inside custom files, modules etc.

Most of examples on the net use mysql_query function. But sometimes it would be reasonable to use native WHMCS function select_query. Or at least to know how it works.


  • $table
  • $fields
  • $where
  • $orderby
  • $orderbyorder
  • $limit
  • $innerjoin


$result = select_query("tblhosting", "nextduedate, billingcycle, lastupdate", array("id"=>$params['serviceid']));
$data = mysql_fetch_array($result);

Unfortunately I cannot say default values and their types. I guess strings and arrays are allowed.

I like the way it standardized. But it is always good to have control over function results etc. So a better way would be to include something powerfull like doctrine.

Little about me:

Im professional web developer. Love to work with PHP-driven projects. WHMCS seems to me the way to share my knowledges. Some of you may be interested in hiring me - drop me a line or take a look at my Odesk profile

Leave a comment