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


i am getting this error- [26-Nov-2019 14:07:56 UTC] PHP Parse error: syntax error, unexpected '$rslastviewed' (T_VARIABLE), expecting ',' or ';' in /home/fbt5bixmgpkq/public_html/dailyShop/product.php on line 301 -<?php //Add the selected product i

Thread began 11/26/2019 11:38 pm by anonymous | Last modified 11/28/2019 11:14 am by Ray Borduin | 355 views | 1 replies |


i am getting this error- [26-Nov-2019 14:07:56 UTC] PHP Parse error: syntax error, unexpected '$rslastviewed' (T_VARIABLE), expecting ',' or ';' in /home/fbt5bixmgpkq/public_html/dailyShop/product.php on line 301

This is my code:
//Add the selected product id to an array when the product detail page is loaded
if(!isset($_SESSION["lastviewed"])) {
$_SESSION["lastviewed"] = array();
//Store up to 5 product ids in my array
$maxelements = 5;
if (isset($_GET['id']) && $_GET['id'] <> "") {// if we have url parameter
//Prevent the same product being added to the array twice
if (in_array($_GET['id'], $_SESSION["lastviewed"])) { // if product id is already in the array
$_SESSION["lastviewed"] = array_diff($_SESSION["lastviewed"],array($_GET['id'])) ; // remove it
$_SESSION["lastviewed"] = array_values($_SESSION["lastviewed"]); //optionally, re-index the array

if (count($_SESSION["lastviewed"]) >= $maxelements) {//check the number of array elements
$_SESSION["lastviewed"] = array_slice($_SESSION["lastviewed"],1); // remove the first element if we have 5 already
array_push($_SESSION["lastviewed"],$_GET['id']);//add the current itemid to the array
} else {
array_push($_SESSION["lastviewed"],$_GET['id']);//add the current itemid to the array


//Use the array contents to filter a recordset, so I can display images of the products with a hyperlink to the product details page.
$criteria = (isset($_SESSION["lastviewed"])?implode(", ",$_SESSION["lastviewed"]):"-1");

$rslastviewed = new WA_MySQLi_RS("rslastviewed",$PowerCMSConnection_i,0);
$rslastviewed->setQuery("SELECT, products.productName, products.productImage1 FROM products WHERE IN (?) ORDER BY FIELD (, ?)");
$rslastviewed->bindParam("il", "".$criteria ."", "-1"); //criteria
$rslastviewed->bindParam("il", "".$criteria ."", "-1"); //listorder

<!-- single sidebar -->

<div class="aa-sidebar-widget">

<h3>Recently Views</h3>
<div class="aa-recently-views">
<?php while(!$rslastviewed->atEnd())
line no-301 :- <a href="product-details.php?id=<?php echo htmlentities $rslastviewed->getColumnVal("id"); ?>" class="aa-cartbox-img">
<img alt="img" src="admin/productimages/<?php echo htmlentities $rslastviewed->getColumnVal("productImage1"); ?>" title="<?php echo htmlentities $rslastviewed->getColumnVal("id"); ?>"
width="150" /></a>
<div class="aa-cartbox-info">
<h4><a href="#"><?php echo htmlentities $rslastviewed->getColumnVal("productName"); ?></a></h4>
<p><?php echo htmlentities $rslastviewed->getColumnVal("productPrice"); ?></p>



Sign in to reply to this post

Ray BorduinWebAssist

htmlentities is a function, so it needs ()... so this: htmlentities $rslastviewed->getColumnVal("id"); should be: htmlentities($rslastviewed->getColumnVal("id"));

(but really you don't need to add htmlentities at all... that is built in to our mysqli recordset code automatically)

Sign in to reply to this post
Did this help? Tips are appreciated...

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