Cat 2 in related content

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 18, 2017   (RSS)

By Dave - July 18, 2017

Hi osga, 

It looks like it should be loading articles that have the same categoryNum.

You can try showing what MySQL query is being used to load related articles by adding 'debugSql' => true (see below).  And you can put a showme() statement right below that see what's being loaded.

$where = "categoryNum = '".mysql_escape($articlesRecord['categoryNum'])."' AND num != '".intval($articlesRecord['num'])."'";     
list($relatedArticles, $relatedArticlesMetaData) = getRecords(array(
'tableName' => 'articles',
'allowSearch' => false,
'limit' => 5,
'orderBy' => 'createdDate DESC',
'where' => $where,
'debugSql' => true, // debug
));
showme($relatedArticles); exit; // debug

Let me know what you find out.

Dave Edis - Senior Developer
interactivetools.com