codeigniter-2

Codeigniter Login check issue in construct / infinite loop

你说的曾经没有我的故事 提交于 2019-12-13 04:08:07
问题 i need to check is user loged or not. i have to many function in controller, so i check it in construct function. but its entering infinite loop. problem is: infinite loop. function __construct() { parent:: __construct(); $this->is_logged_in(); $this->clear_cache(); } function is_logged_in() { if( !class_exists('CI_Session') ) $this->load->library('session'); if( $this->session->userdata('login') ) { $data['name'] = $this->session->userdata('username'); } else { redirect(base_url('admin/login

Codigniter active record update query taking old where clause

本小妞迷上赌 提交于 2019-12-13 04:05:03
问题 I have a following query $this->db->set('registerStep', $param) ->where('id = ',$user_id) ->update($this->table_name); Above Query is producing below sql code. even though I'm supplying only one where condition. UPDATE `users` SET `registerStep` = 2 WHERE `id` = 33 AND `id` = '165' I think active record is using some cached where condition, is there any way I can free where condition. I tried using $this->db->flush_cache(); But it's not helping. 回答1: http://codeigniter.com/user_guide/database

error in creating gallery using codeigniter

北战南征 提交于 2019-12-13 04:03:40
问题 i have pasted some two screen shoots of my database and how actually i want my web page to look. im trying to get this done but not getting how to solve the issue i have stored all the images in folder and also the image path in the database, now i want to fetch the image in such a way that when i click the all works it should display all the images but when i click creative or photography or web development like this then it should show only those images which are related to their classes

How to set minimum upload size in codeigniter

醉酒当歌 提交于 2019-12-13 03:58:26
问题 I want to set minimum width and height for uploading images in codeigniter. The code is shown below. $config['max_width'] = '480'; $config['max_height'] = '270'; $this->upload->do_upload() I have set maximum cut off for this but how to set minimum ?? 回答1: Copy your Upload.php from system/libraries and paste on application/libraries . Then, introduce 2 new variables. public $max_width = 0; public $max_height = 0; public $min_width = 0; // new public $min_height = 0; // new Add these to the

unable to store the multiselect data to database

陌路散爱 提交于 2019-12-13 03:56:35
问题 im trying to store the values in database, all the values are getting dtored in the database but the issue is with dropdown. when i try to upload the multiselect dropdown only the last selected value is getting stored, where as i want to store all the selected values in the database, can some one guide me how can i do that //----controller----- public function portfolio1() { $this->form_validation->set_rules('first_content', 'First content', 'required'); $this->form_validation->set_rules(

Dynamic Database Switch - Codeigniter

不想你离开。 提交于 2019-12-13 03:46:13
问题 I want to switch my codeigniter multiple database on runtime. My Default database will run thoroughly the page but when I needed to switch to other database based on scenario or requirement then I can do. The common model function will work for the all different databases. So, I want to use same model and same function for multiple database connection using dynamic selector without using session or without passing function variable To achieve this I set a name in cofig and when I call my

Call 1 view in Codeigniter but share header/footer among all views? [duplicate]

送分小仙女□ 提交于 2019-12-13 03:06:35
问题 This question already has answers here : Load header and footer view in CI (4 answers) Closed 6 years ago . Loving Codeigniter, but I'm finding it annoying that I have to call a header, footer and the main view for each controller. What is the best way to share a header/footer among all views and minimize replication of code. I don't want to use a template engine. 回答1: create a view, let's call it template.php with this code <?php $this->load->view('header'); $this->load->view($view); $this-

resize image 950*950 in codeigniter

孤街浪徒 提交于 2019-12-13 02:59:56
问题 I hesitated on posting this question cause I saw dozens of them here, but all the answers didn't work. So, I have this working code. It uploads picture and getting thumbnails. I allow users to upload a 950*950 pictures. I want to resize those pics to fit in my show page. So, here is part of the resize: $id=uniqid(); $folder = $this->getDir($id); $dir=FCPATH.'upload/biz_photos/'.$folder.'/'; if(!is_dir($dir)) { mkdirs($dir); } //handle img $des_file=$dir.$id.'.jpg'; $thumb_file=$dir.$id.'

Error: undefined property $load

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:42:51
问题 I am new to codeigniter, and I have developed a code to carry out queries on the database. I load the database using $this->load->database(); and perform a query, but when I run the code, the browser gives me the following error message: A PHP Error was encountered Severity: Notice Message: Undefined property: Tutorial::$load. Fatal error: Call to a member function database() on a non-object This is the code I am using: class Tutorial extends CI_Controller { public function tutorial() { $this

how to catch Uncaught SoapFault exception [closed]

徘徊边缘 提交于 2019-12-13 02:36:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am getting the following error. What is wrong? How I can catch or solve this exception. Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault] The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults