Welcome Guest, Not a member yet? Register   Sign In
Insert ID for an AR Update?
#3

[eluser]codemonkey[/eluser]
[quote author="GrahamDj28" date="1336084875"]If you update a record, then the ID is already known.
How else would you update the correct record?

And as the name implies, it returns the record ID on an insert. Not on an update[/quote]


I see why it wouldn't work.

How can I grab the ID from a loop that checks to see if a value is already in the db?

Example:

Code:
$q = $this
        ->db
        ->where('item_num', $num_to_check)
        ->limit(1)
        ->get('items');

if ( $q->num_rows == 1) {
//then UPDATE
}
//add


Messages In This Thread
Insert ID for an AR Update? - by El Forum - 05-03-2012, 03:31 PM
Insert ID for an AR Update? - by El Forum - 05-03-2012, 03:41 PM
Insert ID for an AR Update? - by El Forum - 05-03-2012, 03:43 PM
Insert ID for an AR Update? - by El Forum - 05-03-2012, 11:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB