MySQL Forums
Forum List  »  Newbie

Re: Creating composite table to store favorites?
Posted by: Peter Brawley
Date: August 21, 2018 08:41PM

I know exactly nothing about React/Redux.

In general terms, for the user to be able to (dis)favour any manu item, you need to browse all manu rows, marking the manu id's foind in the favorites table for this user id. already favoured by the user. so at any time the app knows the user's id, the currently selected manu id, and whether a given item is favoured. Then if the user indicates a desire to disfavour the item, you generate and execute a query like ...

"delete from favorites where user_id=$uid and manufacturer_id=$mid"

... where $uid and $mid are app vars holding the relevant ids, and to add an item ...

"insert into favorites set user_id=$uid, manufiacturer_id=$mid".

Again I've not the slightest idea of R/R syntax for this, you'll need to ask its makers about that.

Options: ReplyQuote


Subject
Written By
Posted
Re: Creating composite table to store favorites?
August 21, 2018 08:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.