0

I'm not a very experienced programmer. I have build a user registration and login system and a webpage for concerts. I want my users to sign up for a concert and have that a list of links shown on their index page based on which concerts they've signed up for. I also want to give them the option to unsign from a concert.

So I have been reading up on it and it seems like I have to create a boolean for every concert and then have that be set to true on button click and then generate a list of all the true booleans for users; so that every user gets the list they've signed up for. I have no idea how to add booleans to mysql (I've created a DB in Phpmyadmin, then added a DB under that with users that now stores id, username, email and password)

I just can't find an option to add those booleans and have no idea where to look. I also don't know how to generate the list, I'm assuming it's pretty simple, since it's just the link to the webpage that they've clicked the button on, but I don't really know where to look

  • 3
    By the sound of it, you need a second table which contains the information for each concert, and a third table which links users to concerts. When a user signs in, you display all the rows in the third table which contain that user id, and separately display all the concerts in the second table, ideally only those that the user isn't already signed up for. To remove a concert from a user, delete it from the third table. To add a concert, insert a row in the third table. Third table probably only needs to contain user-id and concert-id, though you might add to that later. – droopsnoot Aug 17 '23 at 09:46
  • 1
    I agree with droopsnoot. You don't need a boolean for each concert in the user table. That would be a very inflexible database design. You would have to change the design of your database for each new concert you add. So use a new table for the concerts and another for the sign-ups. – KIKO Software Aug 17 '23 at 09:59
  • https://stackoverflow.com/questions/289727/which-mysql-data-type-to-use-for-storing-boolean-values is likely to be relevant i think – ADyson Aug 17 '23 at 10:06

0 Answers0