If I use
SELECT COUNT(id) FROM modx_courses in phpMyAdmin it returns the correct number of records. I then returned
$numRecords on the page which is also correct.
I’m guessing "
if ($ds= $this->db->query($query)){" checks to see of the number of loops = number of records in the specified table in the current database (which is emanz_modx)
Does "
while ($row= $this->db->getRow($ds)) {" mean keep adding the next row until it equals the number of records?
If so, not sure why the array is not getting populated since there is a row called Code etc.
// query the total number of possible records for the table
$query= "SELECT COUNT(id) FROM modx_courses";
$numRecords= $this->db->getValue($query);
// execute the main table query with MakeTable sorting and paging features
if ($ds= $this->db->query($query)) {
// if the query was successful, build our table array from the rows
while ($row= $this->db->getRow($ds)) {
$industries[]= array(
'Code'=> stripslashes($row['Code']),
'Start'=> stripslashes($row['Start']),
'Start'=> stripslashes($row['Start']),
'End'=> stripslashes($row['End']),
'Course'=> stripslashes($row['Course']),
'Location'=> stripslashes($row['Location']),
);
}
}
Since it returns the headers in the page, it would imply the query has retruned rows as per below, however they are not put on the page, only the header row is and the pagination.
// make sure our query of industries has returned rows
if (is_array($industries)) {
// create the table header definition with each header providing a link to sort by that field
$industryTableHeader= array(
'Code'=> $objTable->prepareOrderByLink('Code', 'Code'),
'Start'=> $objTable->prepareOrderByLink('Start', 'Start'),
'End'=> $objTable->prepareOrderByLink('End', 'End'),
'Course'=> $objTable->prepareOrderByLink('Course', 'Course'),
'Location'=> $objTable->prepareOrderByLink('Location', 'Location'),
);