here is the entire table. with SQL bad sign..what's wrong?
if (!$entries = $DB->get_records('public_entries', array(), 'concept ASC')) {
print_error('moduledoesnotexist', 'error');
}
$baseurl = new moodle_url('../public/view.php', array ('id'=>$id));
//$baseurl->params(array('id'=>$id, 'showall'=>$showall));
$tablecolumns = array('concept', 'authors', 'phouse', 'year', 'stranic', 'typep', 'definition','');
$tableheaders = array($strconcept, $strauthors, $strphouse, $stryear, $strstranic, $strtypep, $strdefinition, '');
$table = new flexible_table('public-showentry-list');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
$table->set_attribute('class', 'admintable generaltable');
$table->sortable(true, 'lastname', SORT_DESC);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'public_entries');
$table->set_attribute('class', 'generaltable generaltable');
$table->set_control_variables(array(
TABLE_VAR_SORT => 'ssort',
TABLE_VAR_IFIRST => 'sifirst',
TABLE_VAR_ILAST => 'silast',
TABLE_VAR_PAGE => 'spage'
));
$table->no_sorting('definition');
$table->setup();
if ($table->get_sql_sort()) {
$sort = 'ORDER BY '. $table->get_sql_sort();
} else {
$sort = '';
}
list($where, $params) = $table->get_sql_where();
if ($where) {
$where = 'WHERE '. $where;
}
$query = "
SELECT p.concept, p.authors, p.phouse, p.year, p.stranic, p.typep,
FROM {public_entries} p
$where
ORDER BY p.concept, p.authors, p.phouse, p.year, p.stranic, p.typep,
$sort";
/*
$totalcount = $DB->count_records_sql("
SELECT COUNT(DISTINCT(p.id))
FROM {public_entries} p
LEFT JOIN {user} u ON u.id = p.userid
$where", $params);
$table->initialbars(true);
$table->pagesize($perpage, $totalcount);
*/
if ($entries = $DB->get_records_sql($query, $params, $table->get_page_start(), $table->get_page_size())) {
foreach ($entries as $entry) {
$vstrentri = $entry->concept;
$vauthors = $entry->authors;
$vphouse = $entry->phouse;
$vyear = $entry->year;
$vstranic = $entry->stranic;
$vtypep = $entry->typep;
$vdefinition = $entry->definition;
$icons = public_print_entry_icons($course, $cm, $public, $entry,
$mode, $hook,'html');
$editentries = $icons;
$table->add_data(array(
$vstrentri,
$vauthors,
$vphouse,
$vyear,
$vstranic,
$vtypep,
$vdefinition,
$editentries
));
}
}
$table->print_html();
displays this error:
Debug info: You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'FROM mdl_public_entries p
ORDER BY p.concept, p.authors, p' at line 3
SELECT p.concept, p.authors, p.phouse, p.year, p.stranic, p.typep,
FROM mdl_public_entries p
ORDER BY p.concept, p.authors, p.phouse, p.year, p.stranic, p.typep,
ORDER BY concept DESC, phouse ASC
[array (
)]
Error code: dmlreadexception
Stack trace:- line 443 of \lib\dml\moodle_database.php: dml_read_exception thrown
- line 996 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
- line 455 of \mod\public\view.php: call to mysqli_native_moodle_database->get_records_sql()