Welcome Guest, Not a member yet? Register   Sign In
How to call mysql stored functions

Hello, everyone.

I want call mysql stored function with return value (result of some calculation, summ for example).

I think like this but it doesn't work;

$sql = "? = summ(?, ?)";
$query = $this->db->query($sql, array( NULL, 4, 5));
$row = $query->row();

How I can get returning value?

I find answer:

$sql = "select summ(?, ?) as result";
$query = $this->db->query($sql, array( 4, 5));
$result = $query->row()->result;

I want to write some php file that will be contain all my database function.
I dont know how it better to do. Please give me advice...

May be create helper, or my be use models...

You shold be putting your data in a model.


Theme © iAndrew 2016 - Forum software by © MyBB