model and database |
I have a quick question regarding the connection between model in CI and database. for example:
This is my table: giondacms (database name) ------------------------- pages (table name) pages_name create_date pages_order model/pages_model.php PHP Code: public function insert_pages() Looking at my database and table, is there anything wrong with my pages_model.php ? Thanks in advance, Davy
" If I looks more intelligence please increase my reputation."
None of the fields you are trying to insert are in your table. If you want to insert "title", there has to be a "title" field in your table. Same goes for date, order, and content. Right now you show your only 3 fields as "pages_name", "create_date", and "pages_order" Why not use those in your insert?
(06-12-2016, 08:25 AM)davy_yg Wrote: I have a quick question regarding the connection between model in CI and database. for example: Please follow the tutorial guide at here and read other section too. The real problem is you keep ignoring the documentation.
Keep calm.
Thanks for advice. I fix some stuff:
controllers/cpages.php PHP Code: public function __construct() I get this error that I do not know how to fix: A PHP Error was encountered Severity: Notice Message: Undefined property: pages_model::$load Filename: libraries/Form_validation.php Line Number: 147 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\models\pages_model.php Line: 11 Function: __construct File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\Cpages.php Line: 68 Function: model File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\index.php Line: 315 Function: require_once Any idea how to fix the error?
" If I looks more intelligence please increase my reputation."
PHP Code: public function insert_pages()
Keep calm.
Hello,
I still receive this error message: A PHP Error was encountered Severity: Notice Message: Undefined property: pages_model::$load Filename: libraries/Form_validation.php Line Number: 147 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\models\pages_model.php Line: 11 Function: __construct File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\Cpages.php Line: 68 Function: model File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\index.php Line: 315 Function: require_once controllers/cpages.php PHP Code: public function addpages() models/pages_model.php PHP Code: public function insert_pages() views/add_pages.php PHP Code: <form action="submitpages" method="post"> giondacms (database) pages (table) 1 pages_name 2 create_date 3 pages_order How to fix the error?
" If I looks more intelligence please increase my reputation."
A Model Class and its filename must have the first letter upper case!
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I change the model class name and filename into uppercase.
models/Pages_model.php PHP Code: class Pages_model extends CI_Controller { I still have this error appears: A PHP Error was encountered Severity: Notice Message: Undefined property: Pages_model::$load Filename: libraries/Form_validation.php Line Number: 147 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\models\Pages_model.php Line: 11 Function: __construct File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\Cpages.php Line: 68 Function: model File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\index.php Line: 315 Function: require_once
" If I looks more intelligence please increase my reputation."
Hello,
I am trying to fix this input form so that it could capture information and store it in the database. Yet, even after filling this information and press enter it still does not moves to the database I wonder why? Gionda CMS Pages create_date pages_name pages_order Pages Name: Home Create Date: 552016 Order: 5 Content: Lorem Ipsum ------------------------------------ Thank you for filling the information. It has been successful. Pages Name: Home Create Date: 552016 Order: 5 Content: Lorem Ipsum ------------------------------- views/add_pages.php PHP Code: Code: <form action="submitpages" method="post"> controllers/cpages.php PHP Code: Code: public function addpages() models/pages_model.php PHP Code: Code: public function insert_pages()
" If I looks more intelligence please increase my reputation."
|
Welcome Guest, Not a member yet? Register Sign In |