Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getAllbyLink($table, $what, $url)
- {
- $link=mysql_real_escape_string($url);
- $query = $this->db->query("SELECT * FROM ".$table." WHERE ".$what." = '{$link}' LIMIT 0 , 1");
- if ($query->num_rows() > 0)
- {
- return $query->result();
- }
- else redirect('');
- }
- public function getTable($table, $where = array(), $select = '*', $order_by = '', $limit = '', $offset = '') {
- if ($order_by !== '' && $order_by != 'RANDOM') $this->db->order_by($order_by);
- if ($order_by == 'RANDOM') $this->db->order_by('id', 'RANDOM');
- if ($limit !== '') $this->db->limit($limit, $offset);
- $this->db->select($select);
- $q = $this->db->get_where($table, $where);
- return ($q->num_rows() > 0) ? $q->result() : FALSE;
- }
- getTable($talbe, array('what' => $link));
- //returns FALSE if no data are selected,
- //or returns object with data,
- public function getTable2($table, $where = array(), $limit = '', $offset = '') {
- if ($limit !== '') $this->db->limit($limit, $offset);
- $q = $this->db->get_where($table, $where);
- return ($q->num_rows() > 0) ? $q->result() : FALSE;
- }
- if (!$my_data = getTable2('table', array('where' => $link))) {
- //there is some DATA to work with
- echo "<pre>";
- var_dump($my_data);
- echo "</pre>";
- } else {
- //no DATA do redirect or tell user that there is no DATA
- redirect(); //redirect to default_controller
- }
- public function getAllbyLink($table,$url,$what)
- {
- $query = $this->db->query("
- SELECT *
- FROM `".$table."`
- WHERE `".$what."` = '".mysql_real_escape_string($linkurl)."'
- ORDER BY RAND()
- LIMIT 1
- ");
- if( !$query) return redirect('');
- $result = $query->result();
- if( !$result) return redirect('');
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement