I would like to create a customized view and search page by writing my own module because I believe that Views is unable to do what I want. This requires me to write my own SQL queries, as well. Is there an API call I can use to get all the data and values about a specific node? For example, if I had a content type that asked for your first name and last name:

$values = get_node($nid)

and $values would end up looking something like:


Right now, it seems that all the fields and values are in their own tables, which makes it a nightmare in writing my SQL query to gather all data about the particular node.

1 Answer 1


You can use node_load() function.


 $node = node_load(nid); //you will get all fields values of particular node
  • for better formatting print "<pre>"; print_r ($vars); print "</pre>"; or you can also use debug($node);
    – devunder
    Oct 19, 2012 at 8:38
  • Thank you!!!! I knew the Drupal developers would think of this!
    – user785179
    Oct 19, 2012 at 16:05

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.