Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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