codeigniter

Class 'CI_Excel' not found

我的未来我决定 提交于 2020-01-03 04:28:06
问题 When I load the library of excel I got this error. I follow everything in this Tutorial and still got some error Im using codeigniter framework. Class 'CI_Excel' not found in /var/www/html/warehouse/system/core/Common.php on line 196 this is my controller class Dashboard extends CI_Controller { public function __construct(){ parent::__construct(); $this->load->library('excel'); $this->load->model('dashboard_model'); } public function download(){ $this->excel->setActiveSheetIndex(0); $this-

get logged in user info in CodeIgniter (HMVC & Ion Auth)

女生的网名这么多〃 提交于 2020-01-03 03:44:09
问题 I am trying to get Logged in user details in CodeIgniter (HMVC & Ion Auth) $data['user'] = $this->ion_auth->user()->row(); When i try to display i am getting error Undefined variable: user I am not sure how to get loggin in user id or email. I need id or email. Please help 回答1: If your are trying to display it in view, Are you passing the $data variable to the view ? $data['user']=$this->ion_auth->user()->row(); $this->load->view("filename",$data); If you are trying to access it with the

how to update database table when session expired in codeigniter

夙愿已清 提交于 2020-01-03 03:39:06
问题 I'm new in PHP and Codeigniter, by the way how to update database table when session in CI is expired and where I can put the code? I use uniqid in database, it's called token. here is my login table username, password, level, token, last_login, exp_time . and I want to change value token=null when session in Codeigniter is expired. 回答1: To do this you have to you have to extend CI_Session Create a php file inside application/core/MY_Session.php class MY_Session extends CI_Session { public

CodeIgniter error- unable to connect to database using the provided settings

泪湿孤枕 提交于 2020-01-03 03:38:05
问题 I am new to PHP and CodeIgniter and I am trying to fetch data from a mysql table using MVC pattern of codeIgniter. My model class is: <?php class News_Model extends CI_Model { public function _construct() { $this->load->database(); } public function get_news($id) { if($id!=FALSE) { $query= $this->db->get_where('news', array('id' => $id)); return $query->row_array(); } else { return FALSE; } } } ?> and my database.php file is: $active_group = 'default'; $active_record = TRUE; $db['default'][

CodeIgniter - Users should only have access to their own images

放肆的年华 提交于 2020-01-03 03:30:09
问题 I am currently trying to develop an image uploading website by using CodeIgniter. The thing is, I came across an issue today and I would really appreciate any kind of help in order to solve it. So basically, the site is working. But the thing is, that the files are not private. A user may want to ensure that the files the users upload are only visible by them, and not by someone who just guesses a bunch of urls. (eg. user1 uploads image1 which he wants to keep private, for himself =>

How to change the extension in view using codeigniter 3?

强颜欢笑 提交于 2020-01-03 03:18:08
问题 Here's my problem I setup Codeigniter 3 in my local and use an thirdparty (MX thing) now that I have adjusted the file path, I wanted to change the file extension that is being fetch the controller. $this->load->view('welcome_message'); I change the file in views from: welcome_message.php to this welcome_message.html Now I get this error An Error Was Encountered Unable to load the requested file: welcome_message.php but I wanted to use the .html extension becuase the folder path that I will

Set a selected option in menu dropdown with codeigniter

雨燕双飞 提交于 2020-01-03 03:11:06
问题 I chose to use tag instead of form_dropdown() from Form Helper because i can't set a class atribute to <option> tag. So I have a <select> and want to set a item with as "selected" . This data is coming from database. How I set this? I saw this: set_select() but I can't make work. Does anyone have a solution? 回答1: From the docs on the form_dropdown function: form_dropdown() Lets you create a standard drop-down field. The first parameter will contain the name of the field, the second parameter

RESTful API - How do I return different results for the same resource?

瘦欲@ 提交于 2020-01-03 03:03:09
问题 Question How do I return different results for the same resource? Details I have been searching for some time now about the proper way to build a RESTful API. Tons of great information out there. Now I am actually trying to apply this to my website and have run into a few snags. I found a few suggestions that said to base the resources on your database as a starting point, considering your database should be structured decently. Here is my scenario: My Site: Here is a little information about

two dimension session issue with codeigniter

喜欢而已 提交于 2020-01-03 02:56:56
问题 I want to store two dimensional array in session, where i keep creating the array through a function call. I am trying with this code function nextQuestion($questionId,$response) { $this->session->set_userdata("res[$questionId][]"),$response); } but this is not creating a two dimensional array 回答1: The key stored in the session must be a string but the value can be a multi dimensional array. You can retrieve the array, manipulate it and save it in the session again like this: $session

ajax callings to functions in the controller codeigniter

早过忘川 提交于 2020-01-03 02:46:05
问题 I am using codeigniter 3 and I am having a strange issue using ajax. I'm trying to call two ajax simultaneously and I thought I have problem with my ajax code and I asked this question here and nothing worked with me. I kept making the code more simple and narrow it down until I discover that the problem seems to be with the codeigniter Here is my js code: do_download(); get_operation_status(); function get_operation_status() { //var url_process_info = "http://www.example.com/public/sleep