| Server IP : 101.53.144.229 / Your IP : 216.73.216.181 Web Server : Apache System : Linux host.gdigitalindia.in 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : digitalshiksha ( 1179) PHP Version : 5.6.40 Disable Function : eval,show_source,system,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,show_source,curl_multi_exechellcmd, ini_restore,apache_get_modules,get_cfg_var,passthru, exec ,proc_get_status,fpassthru,c999_buff_prepare,c999_sess_put,c99_buff_prepare,c99_sess_put,proc_close,ini_alter,dl,symlink,link,proc_close,ini_alter,dl,symlink,link,mail MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/digitalshiksha/public_html/application/models/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* End of file blog_model.php */
/* Location: ./application/models/blog_model.php */
#[\AllowDynamicProperties]
class Blog_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function getblogs($field = NULL, $value = NULL)
{
$this->load->database();
if ($field != NULL && $value != NULL) {
$this->db->where('status', 1);
// $where = "name='Joe' AND status='boss' OR status='active'";
$this->db->where($field, $value);
}
$this->db->order_by('date_added','desc');
$query = $this->db->get('blog');
return $query->result_array();
}
function get_posts($number = 10, $start = 0)
{
$this->db->select();
$this->db->from('blog');
$this->db->where('status',1);
$this->db->order_by('date_added','desc');
$this->db->limit($number, $start);
$query = $this->db->get();
return $query->result_array();
}
public function categoryblogs($link)
{
$query = "SELECT * FROM blog WHERE category like '%\"".$link."\"%' and status = '1'";
$result = $this->db->query($query);
return $result->result_array();
}
function search_blog($query)
{
$this->db->select();
$this->db->from('blog');
$this->db->like("post_title", $query, 'both');
$this->db->or_like("post", $query, 'both');
$this->db->order_by('date_added', 'desc');
$query = $this->db->get();
return $query->result_array();
}
function get_post_count()
{
$this->db->select()->from('blog')->where('status',1);
$query = $this->db->get();
return $query->num_rows;
}
function get_post($link)
{
$this->db->select();
$this->db->from('blog');
$this->db->where(array('status'=>1,'link'=>$link));
$this->db->order_by('date_added','desc');
$query = $this->db->get();
return $query->first_row('array');
}
function addblog($data)
{
$this->db->insert('blog',$data);
redirect('admin/blogs');
}
function editpost($link, $data)
{
$this->db->where('id',$link);
$this->db->update('blog',$data);
redirect(base_url('admin/blogs'));
}
public function removeimg($table = NULL, $tablecol = NULL, $col = NULL, $link = NULL)
{
$this->db->set($tablecol,"");
$this->db->where($col, $link);
$this->db->update($table);
}
}