U
U
urajo2019-09-15 20:33:17
MySQL
urajo, 2019-09-15 20:33:17

How to make a request and immediately display it on the screen?

I make a request connection.query("INSERT INTO ... It creates a new line, how can I immediately pick up a column from this line?
At the time of creation, one of the columns is automatically affixed (id), I immediately display this id after creation.
You can, of course, do immediately another request that will take the last added BUT, it is not clear how this will behave if 2 people simultaneously create

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Zver, 2019-09-15
@kirillzver

When using INSERT, and set to autoincrement, you can get the id of the newly added column like this: result.insertId

S
Sergey c0re, 2019-09-16
@erge

php mysql how to get id of added record
mysql_insert_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question