php - What is the correct practice to incorporate models? -
I am trying to simplify the process of inserting data into my database, so I created a model that That handles variable extraction and inserting data.
I understand that this model is a function symbol, and then you call this function (such as / controller / model) and pass the related data through the model for processing. However, I am unsure about how to include the model, how to call it, or what should be written so that I can call the function. I'm using CodeIgniter.
This is a stated model:
class createproject ActiveRecord extended {function __insert () // This function will handle the information related project information in the database. {$ This-> Project_name = $ this- & gt; Input-> Get_post ('project_name'); // ... SPEPING ~ 30 variable definitions ... $ this- & gt; Db- & gt; Insert ('project_details', $ this); }
So I'm confused from here; Where can you put this model for processing, and how will you use it in controllers or the rest?
Thank you!
You can import it into your controller (expected_once) (save it to models.php), And immediately in your controller:
$ CP = new project () $ cp-> __ Insert ()
Comments
Post a Comment