Drupal Developer following code works effectively for displaying a paginated listing of Drupal customers.
operate generate_list() { $question = db_select('customers', 'u') ->lengthen('PagerDefault') ->fields('u', array('identify', 'uid')) ->orderBy('created', 'DESC') ->restrict(20); $outcome = $query->execute(); $listing = array(); foreach ($outcome as $row) { $listing[] = sprintf('<a href="/consumer.php?id=DEpercentu">%s</a>', $row->uid, $row->identify); } $theme_args = array('gadgets' => $listing, 'sort' => 'ul'); return theme('item_list', $theme_args) . theme('pager'); }
I attempted fetching from an exterior SQL-table utilizing Drupal Development Company following code.
operate generate_list() { $question = db_select('pref_users', 'u') ->lengthen('PagerDefault') ->fields('u', array('first_name', 'id')) ->orderBy('created', 'DESC') ->restrict(20); $outcome = $query->execute(); $listing = array(); foreach ($outcome as $row) { $listing[] = sprintf('<a href="/consumer.php?id=%s">%s</a>', $row->id, $row->first_name); } $theme_args = array('gadgets' => $listing, 'sort' => 'ul'); return theme('item_list', $theme_args) . theme('pager'); }
I get this error.
PDOException: SQLSTATE[42P01]: Undefined desk: 7
ERROR: relation "drupal_pref_users" doesn’t exist at character 67: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {pref_users} u) subquery; Array() in methodology PagerDefault->execute() (line 75 in file contains/pager.inc).
Does anyone please know a solution to inform Drupal to fetch knowledge from pref_users and never from {pref_users} at it appears to do?