Issue #2194027 by KelvinWong, sphism: Fix up database topic docs example queries
parent
627a891f51
commit
67401f398c
|
@ -35,12 +35,14 @@
|
||||||
* For example, one might wish to return a list of the most recent 10 nodes
|
* 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
|
* authored by a given user. Instead of directly issuing the SQL query
|
||||||
* @code
|
* @code
|
||||||
* SELECT n.nid, n.title, 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
|
||||||
|
* ORDER BY n.created DESC LIMIT 0, 10;
|
||||||
* @endcode
|
* @endcode
|
||||||
* one would instead call the Drupal functions:
|
* one would instead call the Drupal functions:
|
||||||
* @code
|
* @code
|
||||||
* $result = db_query_range('SELECT n.nid, n.title, n.created
|
* $result = db_query_range('SELECT n.nid, n.title, n.created
|
||||||
* FROM {node} n WHERE n.uid = :uid', 0, 10, array(':uid' => $uid));
|
* FROM {node} n WHERE n.uid = :uid
|
||||||
|
* ORDER BY n.created DESC', 0, 10, array(':uid' => $uid));
|
||||||
* foreach ($result as $record) {
|
* foreach ($result as $record) {
|
||||||
* // Perform operations on $record->title, etc. here.
|
* // Perform operations on $record->title, etc. here.
|
||||||
* }
|
* }
|
||||||
|
|
Loading…
Reference in New Issue