I have a table name wishlist. In this I have two fields user_id and product_id.
In a page, I will check if the $user_id and $product_id variables are found in this table.
If are they found in the same row then a found message is appeared, otherwise a not found message. It may only be found once.
How can I do this?
This is my wishlist table
user_id product_id
1 13
2 23
and suppose the $user_id = 1 and product_id = 13
Something like this should do the trick:
Some databases even have special optimizations for the
select exists (select 1 ...)construct so they can short circuit it rather than finding all the possible matches.