MySQL question tquery
#1

Hi..

I'm using mysql_tquery to INSERT a new base into the database that I have just created. I then wish to assign the inserted values to the base Enums aswell.. but I do not know the base ID that gets auto incremented.

How should I get that ID so I know the base ID (BaseInfo[baseid][bOwner] for example). I thought maybe to use the callback with tquery and then I can do 'cache_insert_id();'?

But I am getting the player position when he types the CMD.. does it affect something if I get the player position in the query callback?
Reply
#2

cache_insert_id will return the value from your auto_incremented column.

Yes you can get the players position in mysql callback function, you can do whatever you want there. It's the same as any other function.
Reply
#3

Quote:
Originally Posted by Dan.
Посмотреть сообщение
I thought maybe to use the callback with tquery and then I can do 'cache_insert_id();'
Exactly. You can pass the position to the callback or fetch it in the callback itself. I don't think it really matters where you decide to fetch it as inserting a single new record happens almost instantly.

Edit: slightly slow.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)