Y
Y
Yura_Mart2018-05-27 18:58:29
PHP
Yura_Mart, 2018-05-27 18:58:29

There is a simple INSERT. How to make a check when writing two fields so that it does not write a duplicate?

supports_user table:

id    |   support_id   |   client_id
1     |          2        |       13
2     |          2        |       13

$query1 = "INSERT INTO supports_user (support_id, client_id) VALUES ('$support_id', '$client_id')";

How to avoid such duplication? What if there is such a support_id with the same client_id, then do not write it down?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasya, 2018-05-28
@haramba

https://dev.mysql.com/doc/refman/8.0/en/replace.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question