Codeigniter 4 – Query Builder class with Example

Codeigniter 4 - Query Builder class with Example Query Builder Basics - The Query Builder class provides a simple and intuitive way to build and execute database queries. - Use the db_connect() function to connect to a database and then use the query builder to execute queries. Example: $db = db_connect(); $db->table('my_table')->get(); Selecting Data -...

Codeigniter 4 – Connecting to Database with Example

Codeigniter 4 - Connecting to Database with Example Connecting to a Database - Use the db_connect() function to connect to a database. Example: $db = db_connect(); Specifying the Database Group - Use the db_connect() function with the database group name to connect to a specific database. Example: $db = db_connect('my_group'); Specifying the Database Configuration -...

Codeigniter 4 – Setting Database with Example

Codeigniter 4 - Setting Database with Example Configuring the Database - Open the app/Config/Database.php file and add your database settings. Example: public $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'my_database', 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => (ENVIRONMENT !== 'production'), 'cacheOn'...

Codeigniter 4 – URL Helpers with Examples

Codeigniter 4 - URL Helpers with Examples URL Helpers - URL Helpers are a set of functions that assist with creating and manipulating URLs. - URL Helpers are stored in the system/Helpers/URL_helper.php file. Loading the URL Helper - Use the helper() function to load the URL Helper. Example: helper('url'); Base URL - Use the base_url()...

Codeigniter 4 – Inflector Helper with Examples

Codeigniter 4 - Inflector Helper with Examples What is an Inflector? - An Inflector is a helper that assists with pluralizing and singularizing words. - Inflectors are useful for creating dynamic URLs and handling data. Loading the Inflector Helper - Use the helper() function to load the Inflector Helper. Example: helper('inflector'); Pluralizing Words - Use...

Codeigniter 4 – Form Helper with Examples

Codeigniter 4 - Form Helper with Examples Form Helpers - Form Helpers are a set of functions that assist with creating and managing forms. - Form Helpers are stored in the system/Helpers/Form_helper.php file. Loading the Form Helper - Use the helper() function to load the Form Helper. Example: helper('form'); Creating a Form - Use the...

Codeigniter 4 – Helpers with Examples

Codeigniter 4 - Helpers with Examples What is a Helper? - A Helper is a file that contains a collection of functions that assist with common tasks. - Helpers are stored in the app/Helpers directory. Creating a Helper - Create a new file in the app/Helpers directory (e.g. my_helper.php). - Add functions to the file...

Codeigniter 4 – Views with Examples

Codeigniter 4 - Views with Examples What is a View? - A View is a file that contains the HTML and PHP code for displaying data to the user. - Views are stored in the app/Views directory. Creating a View - Create a new file in the app/Views directory (e.g. user_view.php). - Add HTML and...

Codeigniter 4 – URL’s with Examples

Codeigniter 4 - URL's with Examples URL Basics - URLs in CodeIgniter 4 are handled by the URI class. - The URI class provides methods for working with URLs. URL Structure - CodeIgniter 4 URLs follow the following structure: `(link unavailable) - controller is the name of the controller class. - method is the name...

Codeigniter 4 – Controllers with examples

Codeigniter 4 - Controllers with examples What is a Controller? - A Controller is a class that acts as an intermediary between the Model and View. - It receives input from the user, interacts with the Model to perform business logic, and passes data to the View for rendering. Creating a Controller - Create a...

Shopping cart0
There are no products in the cart!
Continue shopping
0