Forum Moderators: coopster
the query returns no rows. How would be a nicer way to write this without getting those warnings.
$class_pi->db->setQuery("SELECT sectio.......LIMIT 1");
$rows = $class_pi->db->loadObjectList();
$row = $rows[0];
I could of course check for the existence of results first, which does take care of those warnings.
$class_pi->db->setQuery("SELECT sectio.......LIMIT 1");
$rows = $class_pi->db->loadObjectList();
if(count($rows)){
$row = $rows[0];
$section_id = $row->section;
}else{
$section_id = 0;
}
does anyone know nicer code to do this?
Regarding database, it depends what kind of database class you are using, for example you can write your own function to return a single row:
$row = $class_pi->db->getRow('table', array('id' => 100));