Jump to content

Recommended Posts

Right now I have a database that has a user field and a field for the ID of the club that they are advisor of

The problem is that some people advise multiple clubs

Right now I have them listed as seperate usernames

 

For example:

Username - ID - Password - Club

John_Doe - 24 - password - 32

John_Does - 87 - password - 16

 

However, this causes problems when they log in - it turns into an infinite loop of some sort since there's two different users created with this same username

Also, I have the name of their club show up using the Club ID, but if they have two clubs, how can I make both show up?

 

Thank you! Let me know if this doesn't make sense...

You need a many-to-many table:

 

CREATE TABLE clubs_has_users (
  users_id ..,
  clubs_id ..,
  PRIMARY KEY (users_id, clubs_id)
);

 

If you could provide us with your database table structure then we may be of further assistance as to what should come on the ..

Thank you! I'm not familiar with either of those methods, so sorry if I'm not making sense!

 

CREATE TABLE `members` (
  `id` int(4) NOT NULL auto_increment,
  `username` varchar(65) NOT NULL default '',
  `password` varchar(65) NOT NULL default '',
  `club` int(3) NOT NULL,
  `perm` tinyint(1) NOT NULL,
  `email` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=412 ;

 

So in order to add the | to users with multiple clubs, do I have to go through manually, or can I do it an easier way?

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.