Okay, I have a function in my controller that works. However, I shouldn’t be calling the database in the controller (as we all know). I normally can easily migrate information from a model into a controller, but I’m having a hard time with this one. I won’t even share my model version…how would you write this to a model?
$this -> db -> select('title, price, number_sites, number_entries, white_label');
$query = $this -> db -> get('pricing', 3); // limit 3 rows
$row1 = $query->row(0); // 0 grabs first row in table: Package 1
$data['row1'] = $row1;
$row2 = $query->row(1); // 1 grabs second row in table: Package 2
$data['row2'] = $row2;
$row3 = $query->row(2); // 2 grabs third row in table: Package 3
$data['row3'] = $row3;
Just copy and paste it into the model in a function you want to call:
Then in your controller: