I've fixed your page and prevented repeated entries to the cookie.
The issue was in the first line of the recordset:
$rsViewedProducts = new WA_MySQLi_RS("rsViewedProducts",$ecartdb,1);
The "1" at the end is the maximum number of rows to return... updating it to 0 allows it to return all rows.