Welcome Guest, Not a member yet? Register   Sign In
Update until 2 and no more...
#3

[eluser]PhilTem[/eluser]
If I got your problem right, it would be easier for you to run a slightly different query with help of the CI user's guide Wink

[quote author="CI user's gudie" date="0"]
set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE. To illustrate the difference, here is set() used both with and without the escape parameter.
Code:
$this->db->set('field', 'field+1', FALSE);
$this->db->insert('mytable');
// gives INSERT INTO mytable (field) VALUES (field+1)

$this->db->set('field', 'field+1');
$this->db->insert('mytable');
// gives INSERT INTO mytable (field) VALUES ('field+1')
[/quote]

That means for your code:
Code:
$this->db->set('banner', 'banner + 1', FALSE);
$this->db->where('id', $row['id']);
$this->db->update($table);

and it should run over and over and over again without stopping at $row['banner'] == ( 1 OR 2 ) (for 'I don't even know the reason why' Wink )


Messages In This Thread
Update until 2 and no more... - by El Forum - 08-11-2012, 10:24 AM
Update until 2 and no more... - by El Forum - 08-11-2012, 10:36 AM
Update until 2 and no more... - by El Forum - 08-11-2012, 11:02 AM
Update until 2 and no more... - by El Forum - 08-11-2012, 12:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB