Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 829152.patch | 736 bytes | Anonymous (not verified) |
Comments
Comment #1
jhodgdonGood 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...
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedPatch! :)
Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedNice catch, thanks.
Comment #4
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.