{"id":1655,"date":"2023-05-25T04:33:53","date_gmt":"2023-05-25T04:33:53","guid":{"rendered":"https:\/\/itnotes.apjsoftwares.com\/?p=1655"},"modified":"2023-05-25T04:33:53","modified_gmt":"2023-05-25T04:33:53","slug":"how-can-you-add-or-load-a-model-in-codeigniter","status":"publish","type":"post","link":"https:\/\/itnotes.apjsoftwares.in\/index.php\/2023\/05\/25\/how-can-you-add-or-load-a-model-in-codeigniter\/","title":{"rendered":"How can you add or load a model in CodeIgniter?"},"content":{"rendered":"\n<p>To load models in controller functions, use the following function:<a href=\"https:\/\/www.javatpoint.com\/codeigniter-interview-questions-and-answers#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/codeigniter-interview-questions-and-answers#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/codeigniter-interview-questions-and-answers#\"><\/a><\/p>\n\n\n\n<p>$this-<strong>&gt;<\/strong>load-<strong>&gt;<\/strong>model(&#8216;ModelName&#8217;);&nbsp;&nbsp;<\/p>\n\n\n\n<p>If in case your model file is located in sub-directory of the model folder, then you have to mention the full path. For example, if your file location is application\/controller\/models\/project\/ModelName. Then, your file will be loaded as shown below,<\/p>\n\n\n\n<p>$this-<strong>><\/strong>load-<strong>><\/strong>model(&#8216;project\/ModelName&#8217;);\u00a0\u00a0\u00a0\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To load models in controller functions, use the following function: $this-&gt;load-&gt;model(&#8216;ModelName&#8217;);&nbsp;&nbsp; If in case your&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[32],"tags":[],"_links":{"self":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/1655"}],"collection":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/comments?post=1655"}],"version-history":[{"count":1,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/1655\/revisions"}],"predecessor-version":[{"id":1656,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/1655\/revisions\/1656"}],"wp:attachment":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/media?parent=1655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/categories?post=1655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/tags?post=1655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}