Welcome Guest, Not a member yet? Register   Sign In
db query during another query
#1

[eluser]Unknown[/eluser]
Hi,

Let's say I have the following code:

Code:
function getSomeVal(){
//using $this->db->where and get to retrieve and return some value from some table
  
}

//main query
$this->db->where('id', $id);
$this->db->update('mytable', array ('someVal'=>getSomeVal());

As you can see, during while building the main query, I'm calling a function which (to return a value) also builds a query.

I suppose this will not work, what's the solution to this problem? I may forget that the getSomeVal() function also uses db object...


Messages In This Thread
db query during another query - by El Forum - 05-15-2011, 02:00 AM
db query during another query - by El Forum - 05-15-2011, 04:25 AM
db query during another query - by El Forum - 05-15-2011, 06:00 AM
db query during another query - by El Forum - 05-15-2011, 06:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB