Jump to content

Storing User Preferences


ams53

Recommended Posts

I'm pretty new to php/mysql.  Is it possible to write a script where the user stores internal links to other parts of the website under a "my favorites" section.  I need to allow the user to click on a link (i.e. "add to my favorites") next to a product and have an internal link added to that specific users profile under a "my favorites" tab.  I've thought about cookies but the user should be able to access these preferences from any computer.

 

Does anyone have any suggestions?  Any scripts out there for this?

 

Please teach this newbie a thing or two.  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/83524-storing-user-preferences/
Share on other sites

Have a db table that tracks favorites along with the user id.  When they click "Add to Favorites" it'll create an insert statement adding that item the favorites table with the user's id.

 

In this new table, is a new record inserted or a new field created in the table?  If only a record, then do I need a specific number of fields or can I allow an unlimited number of "favorites"?

A new record is inserted, but since you're tracking it by the user id, you can have an unlimited number of favorites.

 

Table should look like this:

 

favorites

fid* (int)

uid (int)

pid (int)

timestamp (timestamp)

 

 

Where:

fid = favorite id, will be the primary key

uid = user id

pid = page id

 

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.