Jump to content

Help? Need help on project with templates involving mysql and php.


DiscoTrio

Recommended Posts

I'm having a hard time explaining what I want but basically here is what I have in place:

 

-Database with 500 members signed up and using under a table called 'users'

-Php page that people click a link and it changes the field 'template' to the corresponding button.

 

And what I want to know is, is there a way that I can record what templates they already chose into another filed on 'users' like this: (1,2,7,4) and so on.  But it needs to add on over time from when someone decides to switch again.

 

To help get more of an idea visit this:  www.robloxianjournal.com/templatesearch.php

 

Id be happy to give more info thanx.

It's generally frowned upon to store multiple values into a single field. The way around this is to use another table (generally named something like user_templates), that will hold a field for user_id and a field for template_id. When a user uses a template you can SELECT * FROM user_templates WHERE user_id=$user_id AND template_id=$template_id. If you get no results then it's not been used before so you can INSERT a new row.

I wouldn't recommend doing on what you plan on doing.

However depending on the popularity of the site and if its an easy solution for you ide stick to it.

It really depends on site usage and how many templates available on how you should do it.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.