The database.inc have these comments

* For example, one might wish to return a list of the most recent 10 nodes
* authored by a given user. Instead of directly issuing the SQL query
* @code
* SELECT n.title, n.body, n.created FROM node n WHERE n.uid = $uid LIMIT 0, 10;
* @endcode
* one would instead call the Drupal functions:
* @code
* $result = db_query_range('SELECT n.title, n.body, n.created
* FROM {node} n WHERE n.uid = %d', $uid, 0, 10);
* while ($node = db_fetch_object($result)) {
* // Perform operations on $node->body, etc. here.

The body field is no longer part of the node table. It belongs to node_revisions now

Comments

brianV’s picture

Version: 6.1 » 6.x-dev
Component: database system » documentation
Status: Active » Reviewed & tested by the community
StatusFileSize
new1.15 KB

Attached patch brings the example in the documentation in line with the D7 documentation. Trivial, so RTBCing myself.

- *   SELECT n.title, n.body, n.created FROM node n WHERE n.uid = $uid LIMIT 0, 10;
+ *   SELECT n.nid, n.title, n.created FROM node n WHERE n.uid = $uid LIMIT 0, 1
- *   $result = db_query_range('SELECT n.title, n.body, n.created
+ *   $result = db_query_range('SELECT n.nid, n.title, n.created
Crell’s picture

I'm Larry Garfield, and I approve this patch. Hey bot, are you paying attention?

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed to Drupal 6, thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.