PDA

View Full Version : my favorites / shortlist with php mysql



lejonesboy
09-08-2006, 02:13 PM
hi, i'm trying to create a section similar to a shopping cart but to use it as a 'my favorties' page. ie. for a holiday rental site where you can add your favorite houses to a short list.. here is a perfect example www.holidayhouses.co.nz (see short list section) of what i'm trying to do in php / mysql...the data base is all set..just need to activate this part with an add to favorites button which essentially stores the rental advert in the cart / favorites / short list page...any help would be great..cheers

arvana
09-09-2006, 10:43 AM
Are your users logged in to an account when they store their favorites? If so, just store their faves in a table against their username. Then the favorites page can query that table and display the relevant houses.

If you want to let anybody store favorites without having to create an account first, then you'll likely have to do it with cookies instead.

Or maybe you could do a combination of both, so if an anonymous user with favorites stored in a cookie then creates an account, their info gets stored in the table for anywhere access.

Does that help?

lejonesboy
09-09-2006, 01:04 PM
thanks for the reply, the users will not be logged on, i'm trying to do it as simple as possible by just using sessions, once the session is ended all information will be deleted, as i'm a novice i am trying to adapt a simple shopping cart to do the job

am currently trying using this tutorial as a guide

http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart

if you know of any better ones please could you post the link.... thanks v much

arvana
09-09-2006, 01:51 PM
There's this one:

http://www.zend.com/zend/spotlight/sessionauth7may.php

and I also recommend:

http://www.paulspages.co.uk/pcp/cookielib/

For the best user experience, it would probably be best if their favorites were saved until next time, and it's quite easy to do, especially if you use the paulspages libraries.

Good luck!

lejonesboy
09-10-2006, 07:35 AM
thanks for the help...will give them both a try..cheers