pdo - How can i return the id of the last updated record in MySQL? -
i using pdo connect mysql. when add new record database , want know id of last record added call lastinsertid()
built in pdo. however, time trying return last updated record. according knowledge pdo::lastinsertid should return last updated id well.
returns id of last inserted row, or last value sequence object
but in case not return should. returns value 0
.
how can configure lastinsertid()
return auto_increment
value of record updated update query?
i count not find way return last updated id. have done accomplish looking checking countrow
method return total effected rows.
so update if record found done. if there no record found insert.
thanks
Comments
Post a Comment