I have an ordering system from 1 to 6 (both inclusive), which the order number is assigned to a news in table featured by user's choice. When a user saves an order for a news, in the table featured is inserted a new row with these fields: id_news, id_user, id_category and order
What I am looking for is for a better syntax to check if there already is a news for client X with order Y.
Right now I'm doing each thing in a separate query, with these actions:
- User chooses to feature news 1241 to order number 3
- Script checks to see if there exists any news for client
Xwith order number 3 - If exists, it deletes it
- Add the new featured news.
Anyway of making all that in less actions/code?