31 May

WHMCS Database tips and tricks – The basics

I’ve been involved with php and MySQL based programming for quite some time. Starting with mysql_xx (now deprecated), I moved to mysqli-> due to the familiarity of things. This was a great choice, but when it came time to get serious about WHMCS development, well, it was time to learn (again).  Hopefully this series will be a bit of help to someone else. My goal is to gain and pass as much knowledge on to you, as the WHMCS documentation (as usual) doesn’t really cover much here. It barely even covers the basic ‘howto’ of doing things.

To begin with, some references:
WHMCS utilizes the laravel codebase. So, their schema and query documentation will most likely come in quite helpful to you. I know they certainly were to me.
WHMCS has a small bit of documentation on MySQL as well.

Important:
When using Capsule, you need to make sure to initialize it at the top of the php file. This will do that:

The basics here:

A simple update query, which will update the tickets table , flagging the ticket to a specific admin, where the id is $ticketid.

Let’s say we want to get a certain number of clients, shall we? This will effectively select 20 clients, starting with row 0

How about some insert fun

How about we grab a single column? For example, let’s say we want to grab the SystemURL. Here’s how

Up next? How do we create a table, add to the table, and more! Be sure to check back!!

Comments (3)

Leave a reply

Leave a Reply