Jump to content

User Registration


miocene
 Share

Recommended Posts

I'm in the process of developing a site that manages payments between members of a group.The site is located hereAs you can see it is currently possible for anyone to use this site and add/remove users/payments (when it's all up and running!)If I wanted to have users registering (as a group i.e a group shares a username/password) so they can use their own account what would I need to do.Are there scripts to download (free?) that do this and do I need loads of MySQL databases (cos my limit is 3 I think)?A single database solution would be best!

Link to comment
Share on other sites

Firstly i like the idea of the site.Their are a number of ways of doing this, you could just create another column into your users table called "family" or "group", then in order for someone to become apart of that family/group they must supplier the family or group name and provide a password, then any member within that group/family already would be able to accept new members into the group/family. i hope you understand.I don't understand the concept of having more than one database i have only ever used one with lots of tables. although i might look into using more databases. i obviously have a back-up database but that is only used to back things up obviously.

Link to comment
Share on other sites

Firstly i like the idea of the site.Their are a number of ways of doing this, you could just create another column into your users table called "family" or "group", then in order for someone to become apart of that family/group they must supplier the family or group name and provide a password, then any member within that group/family already would be able to accept new members into the group/family. i hope you understand.I don't understand the concept of having more than one database i have only ever used one with lots of tables. although i might look into using more databases. i obviously have a back-up database but that is only used to back things up obviously.
yeah that might work but I would prefer a system where each "group" would have their own tables in the database.Currently the site uses just 2 tables - one for the users, and one for the payment records. The number of columns in the payments table depends on the number of users.Would I would like is a system where when a new group of people creates an account they would register like you would on most forum, webmail sites etc. and the site would create 2 tables in the database specially for that group.This sounds like quite a lot of coding and this is only my 2nd ever php thingy (the first being a simple comment box). Hopefully there is a script of some kind I can download and modify to my needs.
Link to comment
Share on other sites

yeah that might work but I would prefer a system where each "group" would have their own tables in the database.
Why? What advantage does creating new tables for each group have that you don't get when all groups are stored in the same table?
The number of columns in the payments table depends on the number of users.
That sounds like you might be getting into problems. You shouldn't have to alter any tables, the vast majority of web applications I've seen and built all use a static database structure, the system isn't actively changing the database structure based on however it's being used. If your application requires changing the database structure, you might want to redesign your database so that it doesn't need to do that.
Link to comment
Share on other sites

Why? What advantage does creating new tables for each group have that you don't get when all groups are stored in the same table?
Well it would make the code a lot simpler in terms of adding and extracting data from the database.What's the problem with adding a new set of tables for each group? Is there a limit?How would most medium/large scale dynamic sites do it (e.g. facebook/ youtube/ this forum etc)I'm very new to php and mysql and not too knowledgeable about how things are done - but I've learnt a lot so far
That sounds like you might be getting into problems. You shouldn't have to alter any tables, the vast majority of web applications I've seen and built all use a static database structure, the system isn't actively changing the database structure based on however it's being used. If your application requires changing the database structure, you might want to redesign your database so that it doesn't need to do that.
yes, you are right. I went into this without realising it until I had done it that way.It would be quite a lot of work to change my database and code so I'll probably leave it for when I have more time
Link to comment
Share on other sites

What's the problem with adding a new set of tables for each group? Is there a limit?
For one, yeah you might run into limits with various storage engines. There is also a limit on the maximum number of columns per table. Also, what happens if you want to add a new column to your groups tables or change the structure? What if you want to add an index to speed things up? How many tables will you need to update?
How would most medium/large scale dynamic sites do it
The tables are organized so that they are related. I've got one application that right now has 70,946 users divided into 6,885 user groups. The largest table there has just under 900,000 rows. Users can belong to more than one group. To store just the users, user groups, and their relationships, I basically use 3 tables. One table holds all of the users and includes an ID column, one table holds all of the user group details and also includes an ID column, and the third table holds pairs of user ID/user group ID rows to assign a certain user to a certain group. If each user can only be a member of one group, instead of the third table you could just add a group ID column to the users table.I'm not trying to say that you never need to alter the database structure dynamically, just that I've never had to do that. It might be the case that for certain types of systems with very large numbers of users that it might be faster to put certain things in their own tables so that you don't need to search through a bunch of extra data when you're only looking for specific data (although, having good indexes on the table will also help speed that up). It's just that I've never seen a need to do that. Maybe the systems I've got just aren't big enough where that would become an issue. It would be interesting to look at the database structure for something like Slashdot, for example. I would imagine that they have a single table for all articles, and a single table for all comments, but I'm not sure. Edited by justsomeguy
Link to comment
Share on other sites

OK I'm redesigning my code and database structure so the tables will remain unchanged - just the data input into them will change.run into a little bit of difficulty - what's wrong with this syntax?:

$result2 = mysql_query("SELECT * FROM userpayments WHERE userid = $userid[$k] ORDER BY id ASC");

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...