How-to articles, tricks, and solutions about CODEIGNITER

Codeigniter $this->db->get(), how do I return values for a specific row?

The $this->db->get() function in CodeIgniter is used to retrieve data from a database table.

CodeIgniter activerecord, retrieve last insert id?

To retrieve the last insert id in CodeIgniter using the Active Record class, you can use the $this->db->insert_id() method.

Codeigniter Rename file on upload

In CodeIgniter, you can rename a file on upload by using the do_upload() method of the Upload class.

Codeigniter: fatal error call to undefined function mysqli_init()

Here's an example of how the error might appear in a Codeigniter application:

Codeigniter's `where` and `or_where`

In CodeIgniter, the where method on the database class is used to add a WHERE clause to your query.

Directory index forbidden by Options directive

This error message typically appears when you are trying to access a directory on a web server that does not contain an index.html or index.php file and the web server is configured to prevent users from browsing the directory.

Getting data posted in between two dates

To get data posted between two dates in PHP, you can use a SQL query with a WHERE clause and the BETWEEN operator.

How to add an ORDER BY clause using CodeIgniter's Active Record methods?

To add an ORDER BY clause to a query using CodeIgniter's Active Record class, you can use the order_by() method.

How to get id from URL in codeigniter?

In CodeIgniter, you can get the value of the id from the URL by using the function $this->uri->segment(n), where n is the position of the segment you want to retrieve.

How to remove "index.php" in codeigniter's path

To remove "index.php" from the URL in CodeIgniter, you can use the .htaccess file.

Only variable references should be returned by reference - Codeigniter

This error message in Codeigniter indicates that you are attempting to return a variable by reference, but only variable references can be returned by reference.

PHP - get base64 img string decode and save as jpg (resulting empty image )

To decode a base64 encoded image string and save it as a JPG file in PHP, you can use the following code:

PHP_SELF vs PATH_INFO vs SCRIPT_NAME vs REQUEST_URI

PHP_SELF, PATH_INFO, SCRIPT_NAME, and REQUEST_URI are all superglobal variables in PHP that provide information about the current URL being requested.

Redirect with CodeIgniter

In CodeIgniter, you can use the redirect() function to redirect the user's browser to a new page.