Custom Function Calls

$db->callFunction();

This function enables you to call PHP database functions that are notnatively included in CodeIgniter, in a platform-independent manner. Forexample, let’s say you want to call the mysql_get_client_info()function, which is not natively supported by CodeIgniter. You coulddo so like this:

  1. $db->callFunction('get_client_info');

You must supply the name of the function, without the mysql_prefix, in the first parameter. The prefix is added automatically basedon which database driver is currently being used. This permits you torun the same function on different database platforms. Obviously, not allfunction calls are identical between platforms, so there are limits tohow useful this function can be in terms of portability.

Any parameters needed by the function you are calling will be added tothe second parameter.

  1. $db->callFunction('some_function', $param1, $param2, etc..);

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

  1. $db->connID;

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

  1. $query = $db->query("SOME QUERY");
  2.  
  3. $query->resultID;