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)