API page: http://api.drupal.org/api/drupal/includes%21database%21database.inc/grou...

The sample code on the Database abstraction layer page includes the following code:

$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.
}

The comment should refer to $record not $node (or the loop should use $node)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Novice, +Needs backport to D7

Good catch! Should be a quick fix...

mjonesdinero’s picture

Assigned: Unassigned » mjonesdinero
Status: Active » Needs review
FileSize
599 bytes

attach is the patch change the comment from is on the loop..

lyricnz’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

jhodgdon’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Thanks! Committed to 8.x. Patch needs porting to 7.x (different file).

jhodgdon’s picture

Status: Patch (to be ported) » Fixed

Never mind, I got it to apply to 7.x by switching to the right sub-directory. Thanks again!

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