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?

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

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


$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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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