Welcome Guest, Not a member yet? Register   Sign In
Ancillary Classes in CI4
#1

i am troubling in  call function in My_helper.php  CI4
i can't  call function in helper page , and cannot connect with Model with    $CI =& get_instance(); 
its is showing error, please help ...
how to call  $CI =& get_instance();  in CI 4
Reply
#2

There is no CI 4 get_instance like CI 3 it's all OOP now.

Helpers are load by an array anywhere or by the array in the BaseController.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 07-30-2020, 03:13 AM by psreejiths.)

(07-29-2020, 02:58 AM)InsiteFX Wrote: There is no CI 4 get_instance like CI 3 it's all OOP now.

Helpers are load by an array anywhere or by the array in the BaseController.
How to call the controller function or model function inside a  particular helper function?

function allcustomers($x)
{
$ci =& get_instance();
$customer_datas=$ci->invoice_model->getallcustomers($x);
echo "<select id='customer' name='customer' class='form-control required' required>";
echo '<option value="">Please Select</option>';
foreach($customer_datas as $listcustomer)
{
echo "<option value='$listcustomer[customer_id]'>$listcustomer[customer_name]</option>";
}
echo "</select>";
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB