MySQL get the id of last affected row
#1

How can you get the ID of last updated row in pawn?
Reply
#2

If the query was an insert then you use cache_insert_id(). Otherwise it's not possible.
Reply
#3

And what if we do the following:

PHP код:
mysql_format(Databasestringsizeof(string), "SELECT * FROM `GodDamnAssetsThatImStuckOn` WHERE `Active` = 0 LIMIT 1"); 
How do we go about getting the ID of that row if we need it?
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
If the query was an insert then you use cache_insert_id(). Otherwise it's not possible.
Then probably only way is to have a column called "pending" and once I update that row I set it to 1 then a SELECT query WHERE pending = 1, get the ID use it and then UPDATE the row again to set the pending column back to 0..

Any better way?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)