First, you folks are amazing. Thank you for the tremendous effort you have put into CI4.
I am testing CI4 on a LIMS that I wrote way back for CI2. I am trying to get sorted results from one of the tables. I think I am doing it correctly but it is just as likely there is something here I am not understanding. I have a table with an auto incremented ID and a Cell_Name column. I am simply trying to do a select all and retrieve the data sorted on the cell name column.
$builder = $this->db->table('cell_lines');
$builder->select('*')
->orderBy('Cell_Line', 'asc');
echo $builder->getCompiledSelect(false);
$query = $builder->get();
$temp_result = array();
foreach ( $query->getResult('array') as $row )
{
$temp_result[] = array(
'ID' => $row['CellID'],
'Cell_Name' => $row['Cell_Name'],
'idCell_Type' => $row['idCell_Type'],
'idGenotype' => $row['idGenotype'],
'idBasel_Media' => $row['idBasel_Media'],
);
}
return $temp_result;
The generated sql is
SELECT * FROM `cell_lines` ORDER BY `Cell_Line` ASC
however I think the order by part is being dropped.
Any suggestions?