edit:
This is all tied to a Drupal function, namely:
db_query_range(SELECT c.* FROM {comments} c WHERE
c.status = %d ORDER by c.timestamp', COMMENT_NOT_PUBLISHED, 0,
$num_posts);
But i'm figuring it's all just plain old SQL - if you catch my drift?
The function definition can be found here.
OK,
consider this:
db schema, specifically the 'comments' table.
where
cid = comment id
pid = post id
OK, things i know:
a '.' means a period or concatenation in php.
an asterix (*) in an SQL query means select All from a table set.
Im just looking for a little clarity in the following query:
$sql = (SELECT c.* FROM {comments} c WHERE
c.status = %d ORDER by c.timestamp', COMMENT_NOT_PUBLISHED, 0,
$num_posts);
Disregarding the
COMMENT_NOT_PUBLISHEDargument, i guess this is some kind of Drupal (Boolean) pre-defined constant.
I'm reading
SELECT c.* FROM {comments}
as SELECT ALL FROM the cid column from the {comments} table. Is this correct? And if someone could walk me through the:
WHERE
c.status = %d ORDER by c.timestamp', COMMENT NOT PUBLISHED, 0,
$num_posts);
query. I mean i have an inkling that the ORDER by clause accepts:
c.timestamp', COMMENT NOT PUBLISHED, 0,
$num_posts
(collectively) as arguments, though i'm not 100%?Again
ORDER by c.timestamp, in plain English, is this equivalent to saying: 'Order the cid column by most recent posts?'
help
This post has been edited by 1cookie: 11 June 2010 - 10:45 AM

New Topic/Question
Reply




MultiQuote






|