Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

Naming method inside of a Class

In MVC OOP  I am getting this warning:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Data_model has a deprecated constructor in

Here is the class in my file data_model.php
Class Data_model extends CI_Model {

    function data_model() {
        $this->load->database();
        $this->table_name = 'data';
    }

Open in new window


How would I call how would you do it?
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Change:
function data_model() {
to
function __construct() {
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robert Granlund

ASKER

Thank you for explaining.  It makes sense now.