Welcome Guest, Not a member yet? Register   Sign In
Database structure - which one is better?
#1

[eluser]Bonyc[/eluser]
Hi,

Though I am new to PHP and CI, I have some personal projects on my mind. I would like to create a website where there will be to 2 Groups of users. Each registered user from UserGroup 1 can create a single page with different information like a profile page and each user from User Group 2 can view the informations (or the profile page) submitted by users from User Group 1 and contact them if necessary. I just wanted to try it out but I am not sure from where I should start. Please provide me with some guidance on a good database structure and from where I should start. Of course I have watched both the video tutorials here on this website and I am confident that I can build some applications now if only I get some more clue.

Also, if someone has developed a tutorial on how to create a job board scipt, a dating website or product information page, please let me know so that I can learn the approach from there too as I think these kind of websites are similar to my project.

Hope to hear from someone Smile

Thank you,
Bonyc
#2

[eluser]depthcharge[/eluser]
Hi,

There are many Auth libraries discussed on this forum and listed in the wiki, which will provide you with the user/groups feature that you require for your site, You will be able to get an idea of the best way to implement the database by looking at the source code and database structure. The thread discussing these libraries have lots of good information.
#3

[eluser]Bonyc[/eluser]
Thanks depthcharge. I will try to find the information on Auth Libraries now.

Regards,
Bonyc
#4

[eluser]Bonyc[/eluser]
Everything working good so far. I have added the DX_Auth and I have created 3 user groups:

1. Member
2. Moderator
3. Admin

** There will be another group of users who will be Guest to my website and who can view some of the data provided by both Members as well as Moderators (eg. in the form of their profile pages).

I would like to achieve the following:
1. Members and Moderators can create one profile page (something like www.mydomain.com/username) with some about 30 fields / 20 fields respectively in it.
2. Moderators can view the profile pages of all Members and can contact them.
2. Admin has full control over all the data submitted.

Please guide me to achieve this if someone has already work on a similar project. If you know of any good information source that will be of help for me, please do leave by a link.

Thanks for all the support Smile
Bonyc
#5

[eluser]obiron2[/eluser]
Welcome to the world of real database programming... the issues you face are ones that we all come across every day.
Do I do something which is simple to build and gets me up and running, but is a pain to manage, or spend some time building a more flexibel solution.

Easy 2 build, but hard to amend..
Create a table with the required fields with a field for UserID which is PRIMARY/UNIQUE and holds the userID from the users table. If you set the database to be PRIMARY/UNIQUE then it will not allow a user to create more than one record in the table.
But if you wnat to change the form fields, you have to cahnge the database structure and manually edit the form generation and data submission.

Hard 2 Build but easy to maintain
table to hold profileTypes (ID, description)
table to hold profileFields (ID, ProfileID, description, field type [int,string,checkbox etc],validation,displayorder,callbacks,formatting, etc)
table to hold userProfiles (ID,USerID,ProfileID)
table to hold userProfileFields (ID, UserProfileID,FieldID,Value)
Functions and processes to build a form with the correct fields, in the correct order, with the correct validation
functions and processes to update the form fields into the correct userProfileFields
If you need to add a field to a profile, you just add it to ProfileFields and the form and database update themselves.

Obiron
#6

[eluser]umefarooq[/eluser]
before viewing profile check group id of members trying to view the profile page if user belong to Moderator or admin group than let him see the page if not give him not access page message.
#7

[eluser]Bonyc[/eluser]
Thank you Obiron and umefarooq for the help. The worst part is that I am completely newbie when it comes to programming and so it will be of really big help if you guys please point me to something from where I can learn step by step, say a similar project someone has done with CodeIgniter. I am ready to invest some time and work on it.

Thanks again for all the help Smile

Bonyc
#8

[eluser]umefarooq[/eluser]
ya here your another problem is solved have look on these two good tutorial about CI also it will help you for login system in CI

http://net.tutsplus.com/tutorials/php/co...er-basics/

http://net.tutsplus.com/tutorials/php/cr...deigniter/

hope both will help you more. if you need more help just put your question on forum or search in forum you will find your problems solutions.




Theme © iAndrew 2016 - Forum software by © MyBB