1

I need to write a query to retrieve all nodes and their published dates for a Drupal 6 website and I would like to know which database table holds the nids and the timestamps. I am aware that there are 6 tables dedicated for storing info related to nodes.

I know about node_load but I do not want to use that?

2
  • can't you use views?
    – uwe
    Jan 7, 2013 at 22:37
  • Nope. This is for writing a module. I need to query it directly from the database.
    – Binny
    Jan 8, 2013 at 8:34

1 Answer 1

1

The node created and updated timestamps are stored in the base "node" table.

e.g

$result = db_query("SELECT nid, title, changed, created FROM {node} ORDER BY nid ASC LIMIT 10");

while($row = db_fetch_object($result)){
  // drupal_set_message($row->title);
  drupal_set_message('<pre>'.print_r($row,1).'</pre>');
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.