I'm making a social gaming network, for learning but mostly because php is alot of fun!
Anyway I want this future..
I wanna let my users chose which "modules" they want activated, like a message board on their profile, polls, buddy list, contact box. Some modules will have to be purchased with points.
Im thinking on something like this:
id
username
passwd
points
msgboard_activated
poll_activated
buddylist_activated
contactbox_activated
Just check if msgboard_activated equals to 1, then include that module on members profile
Some modules (feel free to come with suggestions of modules):
Message board (lets users leave messages on a specific users page)
Buddy list
Poll
I pretty much got the idea from (awesome site!):
http://www.fpsbanana.com/modules
Anyway, Let me hear your thought and idea of this!
Thanks alot and have a good day!
ps.(im BR so expect spelling errors etc)
Oie, Agamemon!
I would encourage you to try a different structure. For instance, three tables, as opposed to a single table.
First, your users table which represents everybody on your site. Second, a modules table which represents all possible modules. This way you can add more in the future without having to add columns to the user table, etc. And lastly we bring them together into a relationship with the usersmodule table, which shows what modules belong to each particular user.
I hope this gives you some direction.
table:users
userid
username
...
table:modules
moduleid
modulename
...
table:usermodules
userid
moduleid
...
Related
Im not a webdev, Im learning all this stuff on the go and I stuck with this stage with my project.
I have a website people can register to use it, so I can store users already. I have a table with different items (item_id, item_name, item_owned). My problem is, every users should have the same list of item, but they can select if they have this item or not on thier own profile.
I could do it make the db and the items are selectable, the db shows 0 if you dont have it or 1 if you have it. But every user sees the same item_owned data and I need it to be user specific.
How can achive this? What structure should I use with the database? Do I need any special libraies beside HTML, PHP, SQL?
Thank you!
I'm almost embarrassed asking this question since I know it should be quite simple yet I can't find an answer to it.
I have a html page with php code in it, that displays let's say a list of companies in a table. I want to make the names of the companies in the table be hyperlinks, such that when a user clicks on a company name, he/she is taken to a page that shows that company's details.
The issue is I cannot have a static page for each company because this list of companies can change every day. So the 'company details' page should be generated dynamically based on what the user clicks.
I am not sure how to approach this. all the questions I see out there seem to talk about static links and pages for static data.
Any guidance is be appreciated!
Every company in the table should have an ID property.
Then when you create the link, do something like this:
Company Name
In your company_details.php you can get the ID of the company from $_GET['id'].
That way you only have one page company_details.php for all companies.
Let's say I have 2 tables : Users and Customers.
Users table contained the admin and manager of the site.
Customers table contained the customer who want to buy something from the site.
Usually Cake Standard is to put everything under one table. But,
Is there anyway in CakePHP 1.3 to have 2 different login with 2 different table?
I know specifically which table has to be used on different page. e.g:
If the site is :
www.domain.com/admin --> This login page should use Users table (default has been implemented)
but now, I need to implement another login page for customer and I decide to separate the table to be cleaner on database part.
www.domain.com --> This login page should use customers table.
So, how to achieve this? Is this a really bad practice?
I honestly think this is indeed a bad practice. You should consider putting every kind of "loggable" user in the same table and having a column named role which defines privileges.
#lucasnadalutti is correct.
however, you dont need a different login page - just change the table in the AuthComponent settings.
$this->Auth->userModel = 'Member';
And, again: please don't do it. follow #lucasnadalutti's advice.
I'm confused on a basic concept. I'm working on a LAMP project where vendors submit products to companies for review. Each company has their own dedicated form that the vendors can access from their dashboard to submit products for review to the companies. Then the companies have their dashboard where they can review these products.
My question is how do I program for the companies to have the ability to switch the questions they want to ask of the vendors? So upon setting up their account I create a form for the companies that include ten questions of their choosing. Obviously there is a way with PHP for the companies to access these ten questions from their dashboard and to swap these questions out for others that will then populate on their forms that show up on the vendors dashboard. Since it affects my database code and my form code I'm confused on how to handle this and I haven't been able to come up with the right search terms for here or google that will show me resources on how to do this. What is the basic concept here? Am I writing code to literally overwrite the php source code for the companies forms page? Or is the database somehow involved with a global list of questions that are chosen? I am sure this is a basic function of php but I have never dealt with it so a "Mr. Potato Head" explanation and a link to a resource from the community would be real helpful.
EDITED:
I may have been asking this question wrong above. This is far more a php question than a MySQL question. I don't understand the concept of customized forms. If a company chooses to swap out one of their questions and I give them a page where they can adjust their questions, what happens after they hit submit and have selected a new set of questions? Do I set the PHP up to completely overwrite the source code of their form page? That doesn't seem right so I am looking for examples of customized forms....
How about you have a table of Questions with lots of possible questions
Then you have a table of Company_Questions which is just a subset of those questions, chosen by the company. You may then add a question to Questions or just create/swap an entry in Company_Questions to the selected Question.
I think you should look at some Data(base) Design books first, because you may be missing some key concepts.
If you have something like this in your database schema:
users(id, name, other params);
questions(id, question);
You need to do a 1:N relationship to save for all customers the questions their want.
user_que(id_user,id_question, order);
Note: the param 'order' is just to specify the order the client want the question, and to clarify you can add more columns if you want to that table.
Well with that you can do the job. Now some SQL
Get the questions from a client
SELECT q.question FROM questions q, user_que uq WHERE uq.id_user = $client_id
Get the clients who have one question
SELECT c.name FROM users c, user_que uq WHERE uq.id_question = $id_question
Hope it helps you.
I want to add reviews and rating to each (clinic) record of the database. If people search a clinic, the webpage shows multiple (clinics) records on the webpage, and then user can rate and write review to any clinic or multiple clinics. Then each clinic will show there won rating stars.
Like in this link
http://search.yahoo.com/search?p=Quiet+Italian+Restaurant%2C+SF&fr=mkg063&ei=UTF-8
User can give different rat and write different reviews to any record like 1, 2, and 3 mentions in above link. Please help me, I will appreciate.
I am using php, html, javascript and mysql.
Your question is pretty broad, but the concepts are roughly equivalent to a CMS system. Content goes in (your reviews) Content goes out (displaying reviews from DB) User login system, and some sort of mechanism to allow the user to find records.
A previous version of this book/article is what helped get me into application development on the PHP side. http://articles.sitepoint.com/article/php-amp-mysql-1-installation It's got all the basics, the rest is up to you.