/**
  * Get a collection of items where the given column matches the given value. e.g. get_by('catID', 2) would get all rows with catID=2.
  * If $val is an array, does a SQL WHERE IN(array)
  *
  * @param string $col
  * @param string $val
  * @param string $order_by_col
  * @return void
  * @author Drew McLellan
  */
 public function get_by($col, $val, $order_by_col = false, $Paging = false)
 {
     if (is_object($Paging)) {
         $select = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT ';
     } else {
         $select = 'SELECT ';
     }
     if (is_array($val)) {
         $sql = $select . ' * FROM ' . $this->table . ' WHERE ' . $col . ' IN (' . PerchUtil::implode_for_sql_in($val) . ') ' . $this->standard_restrictions();
     } else {
         $sql = $select . ' * FROM ' . $this->table . ' WHERE ' . $col . '=' . $this->db->pdb($val) . ' ' . $this->standard_restrictions();
     }
     if ($order_by_col) {
         $sql .= ' ORDER BY ' . $order_by_col;
     } else {
         if ($this->default_sort_column) {
             $sql .= ' ORDER BY ' . $this->default_sort_column . ' ' . $this->default_sort_direction;
         }
     }
     if (is_object($Paging) && $Paging->enabled()) {
         $limit = ' LIMIT ' . $Paging->lower_bound() . ', ' . $Paging->per_page();
         $sql .= $limit;
     }
     $rows = $this->db->get_rows($sql);
     if (is_object($Paging) && $Paging->enabled()) {
         $sql = "SELECT FOUND_ROWS() AS count";
         $total = $this->db->get_value($sql);
         $Paging->set_total($total);
     }
     return $this->return_instances($rows);
 }