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:

<?php
$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)

Files: 
CommentFileSizeAuthor
#2 sample-code-uses-incorrect-variable-1683836-2.patch599 bytesmjonesdinero
PASSED: [[SimpleTest]]: [MySQL] 37,296 pass(es).
[ View ]

Comments

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

Good catch! Should be a quick fix...

Assigned:Unassigned» mjonesdinero
Status:Active» Needs review
StatusFileSize
new599 bytes
PASSED: [[SimpleTest]]: [MySQL] 37,296 pass(es).
[ View ]

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

Status:Needs review» Reviewed & tested by the community

Looks good

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).

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.