Skip to content

Instantly share code, notes, and snippets.

@amitpatil321
Last active August 16, 2016 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitpatil321/ca7d12df5fb7d109b3a8a7721a451be2 to your computer and use it in GitHub Desktop.
Save amitpatil321/ca7d12df5fb7d109b3a8a7721a451be2 to your computer and use it in GitHub Desktop.
Fetching data from custom table
<?
$modx->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$path = MODX_CORE_PATH . 'components/bankquality/';
$result = $modx->addPackage('bankquality',$path.'model/','bq_');
$query = $modx->newQuery('Reviews');
$query->limit(10,10);
$query->sortby('date_added1','DESC');
$quotes = $modx->getCollection('Reviews',$query);
print_r($query->toSQL());
foreach($quotes as $quote) {
$output .= '<p>Id: ' . $quote->get('id');
$output .= '<br/>Name: ' . $quote->get('email');
$output .= '<br/>Type: ' . $quote->get('comment') . '<br/></p>';
}
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment