K
K
KirSupi2021-08-04 21:11:05
MySQL
KirSupi, 2021-08-04 21:11:05

Is it possible to do bulk insert/update in php?

Relatively speaking, there is a table

user  | age
-----------
user1 | 20
user2 | 22

How to make a table like this with one query?
user  | age
-----------
user1 | 22
user2 | 23
user3 | 35

Or do you still have to do two queries for each of them - select to check for existence and insert / update to add / change?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-08-04
@KirSupi

INSERT ... ON DUPLICATE KEY UPDATE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question