already searched for such topics and found 2 different solutions, but no one works.
My table has a structure | ID (auto_increment primary_key) | UID (int) | FAV_ID (int) |
I need to insert a new record in this FAV_TABLE if the UID and FAV_ID (both) already exist.
An example of my request:
INSERT INTO FAV_TABLE (uid, fav_id) VALUES ($u_id,$s_id) ON DUPLICATE KEY UPDATE uid = uid
or this
INSERT IGNORE FAV_TABLE (uid, fav_id) VALUES ($u_id,$s_id);
As the mysql manuals say, this query does not add a record only if PRIMARY_KEY matches. And I need a request not to add an entry if the uid + fav_id pair is unique. Any solutions? Thanks you
source
share