close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

sorting 'recently viewed' items

Thread began 8/23/2010 4:33 am by CraigR | Last modified 8/25/2010 12:59 pm by CraigR | 2061 views | 17 replies

CraigRBeta Tester

thanks for the logic Jason.

i had a go, and depending on how I organise the loops, i get a different result, (neither being the one I want).
I also output the array values in order to check my results, (in red)

First attempt...

<?php do { ?>
<?php for ($i = 0; $i < $totalRows_rslastfiveviewed; $i++){ ?>
<?php print_r ($_SESSION["criteria"][$i]); ?>
<?php if ($_SESSION["criteria"][$i] == $row_rslastfiveviewed['ItemID']) echo $row_rslastfiveviewed['ItemName']; ?>
<?php } ?>
<?php } while ($row_rslastfiveviewed = mysql_fetch_assoc($rslastfiveviewed)); ?>

This results in the array value [$i] being matched in every increment, but in the same order as in the recordset, ie ItemID

Second attempt...

<?php for ($i = 0; $i < $totalRows_rslastfiveviewed; $i++){ ?>
<?php do { ?>
<?php print_r ($_SESSION["criteria"][$i]); ?>
<?php if ($row_rslastfiveviewed['ItemID'] == $_SESSION["criteria"][$i]) echo $row_rslastfiveviewed['ItemName']; ?>
<?php } while ($row_rslastfiveviewed = mysql_fetch_assoc($rslastfiveviewed)); ?>
<?php } ?>

This loops through until I get a match, but I only get one result returned, (although it is the correct one)

can you help me with the logic please ?

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





Ease of use


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