db_table = Config::$db_tables['testimonials']; } public function get_data($id) { return(Database::ado_get_row("SELECT * FROM $this->db_table WHERE id='$id'", "Testimonials::get_data")); } function get_RecordSet($title='', $status='all', $where_add='', $order_by='', $limit='') { $title .= ' Testimonial::get_RecordSet'; // build query and pass to Database::get_RecordSet $select = "*"; $from = $this->db_table; $where = ""; $where_started = FALSE; switch($status) { case '': break; // defaults to all case 'all': break; case 'active': $where .= "status='$status'"; $where_started = TRUE; break; case 'inactive': $where .= "status='$status'"; $where_started = TRUE; break; default: echo 'invalid '.$this->db_table.' status passed to Testimonial::get_RecordSet'; exit(); } if($where_add != '') { $where .= ($where_started) ? " AND " : ""; $where .= $where_add; } return(Database::get_RecordSet($select, $from, $where, $order_by, $limit, $title)); } function get_random() { $sel = "SELECT * FROM $this->db_table WHERE status='active' ORDER BY RAND()"; return(Database::ado_get_row($sel, 'Testimonials::get_random')); } } ?>