I want to get all the comments for certain node, i use db_query. that works fine. But i can not order it by created time. I got PHP Parse error: syntax error, unexpected T_STRING
$results = db_query('SELECT c.nid,c.name, c.uid, c.subject, c.created FROM {comment} c WHERE c.nid = :nid', array(':nid' => $node_id) ORDER By c.created DESC);
foreach ($results as $result) {
}
I found that can be done with db_select, but i would like to know how to do it with db_query?
I think your may want to try following code:
$results = db_query('SELECT c.nid,c.name, c.uid, c.subject, c.created
FROM {comment} c
WHERE c.nid = :nid
ORDER By c.created
DESC',
array(':nid' => $node_id));
foreach ($results as $result) {
}