Then either the SELECT is still wrong or it doesn't give you any rows as a result.As I can't check the SELECT you could try PHPMYADMIN on your webhostingpage to check whether the table name is existing and what the result is for this query. Otherwise you need to have Bob to take another look at his supplied code.

Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!I can also convert your site to a Wordpress site!

$sql->query("SELECT entry_uid FROM pivotx_comments GROUP BY entry_uid ORDER BY 'date DESC LIMIT 20;");

(the difference is in the quotes)

Now "echo $rows;" does no longer return 'entry_uid', but a list of entry_uids. However, "echo $latest_uids;" still turns up nothing (both were placed after the smarty assign phrase). So I guess there must be something wrong in the following part?

@Harm: You are off-track here. You are testing Smarty completely wrong.

@Marza:I'm 110% sure you just have made a typo when copying the code Bob posted. Post the complete code you are using. (PS! In stead of the "complex" subweblog statement, just use [[ $latest_uids ]] to test the value.)

Hans, you're spot on. After all the changes, I went back to the original code, to see if we missed something. And we did. All be it, not in the php part, but in the 'template part', namely the [[ literal ]] [[ /literal ]], that is supposed to be included in all subweblog codes.

It turns out, $latest_ids is not empty at all ( although "echo $latest_uids;" within the php-code still returns nothing!). So we've been a) to occupied with finding flaws in the php code, to notice the missing [[ literal ]] and b) been testing an echo statement that apparently doesn't reflect the outcome we expected.Replacing [[ $latest_uids ]] by the earlier more complex subweblog statement works as well now (profided the 'literal'-code is added)

So, we've made great progress, only the outcome isn't quite right yet. When I compare the outcome of [[ $latest_uids ]] with "The latest comments" that are shown on the dashboard, they don't match. I've got a feeling that the "GROUP BY entry_uid" is processed before the "ORDER BY `date` DESC" statement and that it should be the other way round, but haven't found out how to achieve that.

$sql->query("SELECT entry_uid FROM pivotx_comments ORDER BY `date` DESC LIMIT 20;");

selects the entries in the right order, only with doubles (it's 'latest comments', instead of 'commented on'). It's the 'GROUP BY entry_uid' which returns a completely different order. I haven't quite figured out what the logic behind that ordering is , but know it should be different.

I think what should happen is this:- all comments must be ordered by date first