Save/Create Table Entry
Thu, 07/22/2010 - 23:13
I know I should already know this, but I don't.
I'm trying to insert a new row into a table, using the save method of the metacontrol class. How do I get the auto_increment key of the row just inserted? That auto_increment primary key is the only unique reference I will have to retrieve the row. Does the metacontrol save function return it? My save is returning NULL.
Sorry for the dumb question. I suppose it should be obvious!
Thanks in advance.
LaCeja

If the metacontrol is for the Person object, the ID will be here after you call Save():
$this->mctPerson->Person->Id
Thanks Alex. I was assuming the save would return the Id of the new row, because I was looking at the "return" in the model.
$intNewId = $this->mctPerson->Save();Now, it works perfectly. Maybe I'd better take a day off!
Thanks again,
LaCeja