$myModel = new myModel();
$id = $myModel->insert($data);
$myModel->update($newdata, 'id='.$id);
maxarbos wrote:
>
> Hello,
>
> Is it possible to insert data into a table, then use that 'lastinsertID'
> in an update call to the same row just inserted , all within the same
> transaction?
>
> I want to:
> 1. insert a new row with some data.
> 2. get the last inserted id.
> 3. update the row i just inserted with other data using the iD of that row
> just added.
>
> So is this possible to do within the same transaction?
>
> I know it sounds dumb, but there is other stuff going on between #2 and #3
> that I get data generated from another insert..etc..
>
> Thanks.
>
>
>
-----
visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
--
View this message in context: http://www.nabble.com/Transactions%3A-Possible-to-Insert-and-Update-same-row-in-one-trans--tp21861186p21861566.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论