Created
June 6, 2010 04:44
-
-
Save mrsinguyen/427301 to your computer and use it in GitHub Desktop.
The Drupal Dynamic Query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = db_select('users', 'u'); | |
$query | |
->condition('u.uid', 0, '<>') | |
->fields('u', array('uid', 'name', 'status', 'created', 'access')) | |
->range(0, 50); | |
$result = $query->execute(); | |
//The above is roughly equivalent to | |
$result = db_query("SELECT uid, name, status, created, access FROM {users} u WHERE uid <> 0 LIMIT 50 OFFSET 0"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment