I have this in my database:
table styles
style_id style
1 rock
2 blues
3 jazz
etc...
table user_styles
user_id style_id
1 1
1 2
2 3
etc...
I want do this:
1: Check for s.style for a particular user using below mysql query: "SELECT style FROM styles s JOIN user_styles us ON s.style_id = us.style_id WHERE us.user_id = ?, [UserId]"
2: if you are getting no value, then go for showing all styles present in style table in a dropdown, allow user to select and submit. onSubmit, insert the style detail into user_style table. 3: else show the style for the user.
This is the logic best comes to my mind now. You can also try many other ways as well. I do not see any logical or programatical issue here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.