Welcome Guest, Not a member yet? Register   Sign In
Multiple update in single query.
#7

[eluser]cahva[/eluser]
Even phpmyadmin will parse your sql and execute those line by line.

Smart thing IMO is to build an array and iterate it and use AR's update. Something like this:
Code:
$arr = array(
    4 => array('description' => 'des one'),
    5 => array('description' => 'des two'),
    6 => array('description' => 'des 3')
);

foreach ($arr as $id => $v)
{
    $this->db->update('photos',$v,array('photo_id' => $id);
}

If you have to do very large sets and you're running out of steam, then you should run large queries thru shell using php's exec(or passthru etc.) function and execute your sql there.


Messages In This Thread
Multiple update in single query. - by El Forum - 09-22-2010, 02:18 AM
Multiple update in single query. - by El Forum - 09-22-2010, 04:41 AM
Multiple update in single query. - by El Forum - 09-22-2010, 04:49 AM
Multiple update in single query. - by El Forum - 09-22-2010, 04:52 AM
Multiple update in single query. - by El Forum - 09-22-2010, 05:08 AM
Multiple update in single query. - by El Forum - 09-22-2010, 05:29 AM
Multiple update in single query. - by El Forum - 09-22-2010, 05:35 AM
Multiple update in single query. - by El Forum - 09-22-2010, 03:05 PM
Multiple update in single query. - by El Forum - 04-13-2012, 02:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB