For example…
My table is setup like gameid – userid – rating
When someone submits a rating, I want it to do an insert. But, if the userid and gameid are already together…I want it to just update the rating.
But if maybe that user id is just paired up with another gameid then that’s fine go ahead and make a new row.
I’m sure this is out there, I just don’t really know how to word what I’m trying to do.
Create a composite
UNIQUE INDEXon(gameid, userid), then use a query like:See http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html.