In the code from the text:


$result = db_query_range('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid), 0, 10);
foreach($result as $record) {
// Perform operations on $node->title, etc. here.
}

is an error.
According http://api.drupal.org/api/function/db_query_range/7 (db_query_range($query, $from, $count, array $args = array(), array $options = array())) the code must looks so:


$result = db_query_range('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', 0, 10, array(':uid' => $uid));
foreach($result as $record) {
// Perform operations on $node->title, etc. here.
}

Files: 
CommentFileSizeAuthor
#2 829152.patch736 bytesnenne
PASSED: [[SimpleTest]]: [MySQL] 20,928 pass(es). View

Comments

jhodgdon’s picture

Title: Documentation problem with Database abstraction layer » Database abstraction layer db_query_range() example is wrong
Issue tags: +Novice

Good catch!
The incorrect example is on:
http://api.drupal.org/api/group/database/7
which is generated from the top docblock in includes/database.inc

Good project for a novice documentation contributor...

nenne’s picture

Status: Active » Needs review
FileSize
736 bytes
PASSED: [[SimpleTest]]: [MySQL] 20,928 pass(es). View

Patch! :)

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

Nice catch, thanks.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

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