function getLatestExistsSlug($slug, $table) { $this->db->order_by($table . '_id', "desc"); $this->db->like('slug', slugify($slug)); $this->db->limit(1); $query = $this->db->get($table); $slugName = checkRow($query); if (strpos($slugName->slug, '-') !== false) { $getLastDigit = substr($slugName->slug, strrpos($slugName->slug, '-') + 1); $latestSlugPlus = $getLastDigit + 1; $latestSlugClear = preg_replace('/[0-9]+/', '', $slugName->slug); return rtrim($latestSlugClear, '-') . '-' . $latestSlugPlus; } else { return $slugName->slug . '-' . 1; } }
function getCategorySlug($slug) { $query = $this->db->get_where('category', array('slug' => $slug)); return checkRow($query); }
function getAtletSlug($slug) { $query = $this->db->get_where('atlet_profile', array('slug' => $slug)); return checkRow($query); }
function checkUserId($user_id) { $query = $this->db->get_where("user", array('user_id' => $user_id)); //echo $this->db->last_query(); return checkRow($query); }
function getCatSlug($cat) { $this->db->like('slug', $cat); $this->db->limit(1); $query = $this->db->get('category'); // echo $this->db->last_query(); $row = checkRow($query); // print_r($row);exit(); return $row->category_id; }
function getOrderId($order_item_id) { $query = $this->db->get_where('order_item', array('order_item_id' => $order_item_id)); return checkRow($query); }
function getCategory($id) { $query = $this->db->get_where('product', array('product_id', $id)); return checkRow($query); }