close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Sessions and recordset

Thread began 8/01/2010 12:29 am by victor405909 | Last modified 8/26/2010 7:22 pm by victor405909 | 440652 views | 15 replies

victor405909

The code maybe correct but I cannot get it to do want I want.

I can use a variable in a session to filter recordset no problem. However it only displays one product at a time.

I want it so every time a product is viewed on a details page the product id is stored in a variable. Repeated in a repeat table. This table to show maximum of 10 viewed items. If nothing in table displays "No recently viewed items".

I tried to explain more below, code maybe wrong but you should get an idea where I am heading with this.


User clicks detail page of an item
---------------------------------------------------
<a href=" proDETAIL.php?recordID=34>Dress</a>


Page retrieves product id from url parameter
---------------------------------------------------
$_GET('recordID');



Set product id to session named "recentlyViewedItem" (recordset uses to filter db, HOWEVER THIS IS ONLY ONE ID)
---------------------------------------------------

$_GET('recordID') = $_SESSION["recentlyViewedItem"];


set session variable to easier name to work with
---------------------------------------------------
$_SESSION["recentlyViewedItem"] = $rvItem



That variable needs to be checked to see if it already exist in an array of some kind

(perhaps 10 items to display at any onetime, code for array should be on page or coded on page to check MySql database for exact match, I do not know code to do this)

If ($rvItem in array): Ignore/die

If ($rvItem not in array) AND (all array positions have a value in it) : Delete oldest key/value in array then add $rvItem.

Elseif($rvItem if not in array) AND ( array values are not full) : put $rvItem in array And push other values down in array.

i tried to get recordset to read a test array I created of product ids so products could be viewed in a repeat table.

e.g $_SESSION["recentlyViewedItem"] = array(2,36,54,4)

But this did not work.


After some reading around there seems to be different ways to achieve this
sessions, cookies, using MySql database.

However it appears to be in bits and pieces to me and I am still unclear exactly how to achieve this.

Any ideas?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...