Codeigniter Custom Function Calls

Codeigniter Custom Function Calls – This database reference provides many functions that are used to enable you to call PHP database function that is not natively included in CodeIgniter. For example, let’s say you want to call the mysql_get_client_info() function, which is not natively supported by CodeIgniter. Here in this tutorial, we are going to explain how to use Custom Function Calls.

Codeigniter Custom Function Calls | Example.

Let us understand how Custom Function Calls works in codeigniter with examples.

Custom Function Calls.

Here is simple demo of Custom Function Calls.


You could do so like this.


Syntax of Custom Function Calls.


You must supply the name of the function, without the mysql_prefix, in the first parameter. The prefix is added automatically based on which database driver is currently being used. The permits you to run the same function of different database platform. Obviously not all function call are identical between platforms, so there are limit to how useful this function can be in terms of portability.

$this->db->call_function('any_function', $parameter1, $parameter2, etc.);

Many times, you will either need to supply a database connection ID or a database result ID. The connection ID can be accessed using:


This result ID can be accessed from within your result object, like this:-

$query = $this->db->query("SOME QUERY");


Add Comment

📖 Read More