$sql = "select R.id,R.uri,R.pagetitle,R.content,
(select $TVR.value from $TVR where $TVR.tmplvarid=142 and $TVR.contentid=R.id limit 1) as poster
FROM $R AS R
JOIN $TVR ON R.id=$TVR.contentid
JOIN $MUC ON R.id=$MUC.contentid
WHERE published=1 and deleted=0 and template IN(97,108) and tmplvarid=170 and $TVR.value like ?
ORDER BY $MUC.createdon desc
LIMIT $sqlLimitStart,$itemsPage ";
$q = $modx->prepare($sql);
$q->execute(array($like));
$res = $q->fetchAll(PDO::FETCH_ASSOC);
$stmt->bindValue(':offset', 10, PDO::PARAM_INT);