WHMCS Database Select and loop through results

February 25, 2017

Let's take a look at a simple operation with the database today.

Before using this code you should initialise capsule as written in this post.

Let's say we want to retrieve all the active domains  and then loop through them, we can simply use this code:

 $result = Capsule::table('tbldomains')->where('status', 'Active')->get();

 foreach ($result as $data)
     $id = $data->id;

Leave a Reply

Your email address will not be published. Required fields are marked *