Tag Archives: codeigniter

Codeigniter active records query taking too much time to load data from database

Questions: I’m using codeigniter This is my model <?php class groups_Model extends CI_Model { public function __construct(){ parent::__construct(); } /** * get All groups * @return array object list of groups */ public function get(){ $this->db->select(‘groups.id,groups.name as group,status.name as status’); $this->db->from(‘groups’); $this->db->join(‘status’, ‘status.id = groups.status’); $this->db->order_by(‘groups.id’, ‘ASC’); $this->db->limit($this->config->item(‘per_page’),$this->uri->segment(4)); $query = $this->db->get(); $total = $query->num_rows(); if($total… Read More »

Url hide using codeigniter

Questions: I am using codeigniter… I want a clean URL from below URL http://localhost:8080/rtvnews/index.php/home/videonews?id=67598/newstitle here home => controller, videonews => function and ?id=6586565 is a url string. I want to remove /index.php/home/videonews?id=67598 and replace with /news/ Below Final url I need to get http://localhost:8080/rtvnews/news/newstitle Answers:

CodeIgniter upload fail no error logs no error reporting

Questions: I am trying to upload a file using CodeIgniter. This server seems to have something strange going on because the code works fine on other servers. I’m trying to debug the issue but no errors are being reported. To be specific, the code: if (!$this->upload->do_upload()) { var_dump($this->upload->display_errors()); exit(); } I have turned error_reporting(E_ALL) on… Read More »

How to routing controllers in sub folders using codeigniter 3?

Questions: I have create an controller in subfolder of controller folder and in subfolder i create an login controller. But i couldn’t access this controller and already given rule in route file. Structure : Controller –admin —login.php Route Rule : $route[‘default_controller’] = ‘admin/login’; $route[‘admin_login’] = ‘admin/login’; Answers:

CodeIgniter Session Disappear Bug?

Questions: I am using CI 1.7.3 and here are my settings: $config[‘sess_cookie_name’] = ‘ci_session’; $config[‘sess_expiration’] = 0; $config[‘sess_encrypt_cookie’] = FALSE; $config[‘sess_use_database’] = TRUE; $config[‘sess_table_name’] = ‘sessions’; $config[‘sess_match_ip’] = FALSE; $config[‘sess_match_useragent’] = TRUE; $config[‘sess_time_to_update’] = 300; I cannot come up with steps that cause the session to expire, it just seems random and is very frustrating… Read More »

CodeIgniter 404 Page Not Found, but why?

Questions: I am using CodeIgniter for two applications (a public and an admin app). The important elements of the document structure are: /admin /admin/.htaccess /admin/index.html /application /application/admin /application/public /system .htaccess index.php The /admin/.htaccess file looks like this: DirectoryIndex index.php RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] The /admin/index.php has the… Read More »

Why doesn't cookie work in CodeIgniter?

Questions: I use this function to add cookie and it adds perfectly as I can see in browser options. function login($username,$password){ $cookieUsername = array( ‘name’ => ‘user’, ‘value’ => md5($username), ‘expire’ => time()+1000, ‘path’ => ‘/’, ‘secure’ => TRUE ); $cookiePassword = array( ‘name’ => ‘pass’, ‘value’ => $password, ‘expire’ => time()+1000, ‘path’ => ‘/’,… Read More »