Tutorialsplane

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.

$this->db->call_function();

You could do so like this.

Example:-

Syntax of Custom Function Calls.

$this->db->call_function('get_client_info');

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->db->conn_id;

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

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

Models

Connect Database

Helpers

Libraries

Helper Reference

Library Reference

Database Reference