Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a favourites list?

Status
Not open for further replies.

meeble3

Programmer
Joined
Nov 8, 2004
Messages
52
Location
GB
I have lots of records in the database and at the moment, a user can query the database with an HTML form and display the results searched for according to criteria.

What I would like is, if they come across a record they like, they can click a button and add it to a favourites list which is always displayed on the screen. (They can have up to 5 on the list).

Has this been done before? Are there any available scripts anywhere to cater for this? I couldn't find any.

What's the best way to go about it? Using sessions?
 
I would say if the favorites need to be remembered over time (i.e. user comes back next week and you want it to remember the favorites) you would need to use cookies.

If the favorites list is for the current session (when user leaves site it isn't mandatory to keep the favorites list anymore) then use sessions.
 
why not have it when they click the button it submits the item/url or what ever into a "favorites" table that has columns "user" and "favorite" and have the "favorites" section of the site query the database for "select * where user = $var_user" and grab all their favorite.. also add a check for the 5 if there is already 5 make it bump the first added or make them delete one first.. or maybe you can make a "more" section where it shows ALL of there favorites and the main page only shows the last 5 they have added which in that case you would want to add a column for "date" added.


Ideas.. hope they help alot and im sure there is pre made scripts out there.

in the begining man created code.
in the end code will create man.
clones are coming only matter of time.
examples?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top