public function getSpeciesByID($id) { $db = DB::instance(); $query = 'SELECT * FROM species WHERE speciesid=?'; $db->query($query, 'i', array($id)); $resultRow = $db->fetchResult(); $this->populate($resultRow); $commonName = new commonname(); $this->commonNames = $commonName->getCommonNameBySpeciesID($this->speciesid); }
public function getCommonNameBySpeciesID($speciesid) { $resultNames = array(); $db = DB::instance(); $query = 'SELECT * FROM `common-names` WHERE speciesid=?'; $db->query($query, 'i', array($speciesid)); while ($resultRow = $db->fetchResult()) { $commonName = new commonname(); $commonName->populate($resultRow); $resultNames[] = $commonName; } return $resultNames; }