D
D
Dodat2022-04-08 23:49:46
MySQL
Dodat, 2022-04-08 23:49:46

How to select an ID from table 1 - other than the ID that is already in table 2 (in the field called UID)?

How to select an ID from table 1 - other than the ID that is already in table 2 (in the field called UID)?

I am writing a request:

$sql=mysqli_query($link, "SELECT id FROM users where gender='$search_gender' and photo_check='yes'
and id not in (select kogo from likeit where kto = $print_query_id) ORDER BY rand()");

Works but wrong. In the request, the variables are of course different, but the essence is the same.

Simply put, the user likes the user and this is recorded in the second table.
In order not to offer to like the same user.

How to make a request?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question