codeigniter-2

Severity: 8192 Message: Methods with the same name as their class will not be constructors in a future version of PHP;

。_饼干妹妹 提交于 2019-12-01 20:51:23
问题 Severity: 8192 Message: Methods with the same name as their class will not be constructors in a future version of PHP; CI_Pagination has a deprecated constructor Filename: libraries/Pagination.php Line Number: 27 class CI_Pagination { var $base_url = ''; // The page we are linking to var $total_rows = ''; // Total number of items (database results) var $per_page = 10; // Max number of items you want shown per page var $num_links = 2; // Number of "digit" links to show before/after the

how to switch database in codeigniter

徘徊边缘 提交于 2019-12-01 18:45:24
问题 i'm new to CI and i just wanna know is there a way to switch databases in CI,Eg: In login Page, there's a dropdown list that you can specify which database you wanna connect with, view look like this <select name="select" id="select" > <option value="1">DB1</option> <option value="2">DB2</option> </select> And i got 2 databases in database.php one is default the other is local by default i'm using the default one. $active_group = 'default'; $active_record = TRUE; My question is how do i

Severity: 8192 Message: Methods with the same name as their class will not be constructors in a future version of PHP;

老子叫甜甜 提交于 2019-12-01 18:40:36
Severity: 8192 Message: Methods with the same name as their class will not be constructors in a future version of PHP; CI_Pagination has a deprecated constructor Filename: libraries/Pagination.php Line Number: 27 class CI_Pagination { var $base_url = ''; // The page we are linking to var $total_rows = ''; // Total number of items (database results) var $per_page = 10; // Max number of items you want shown per page var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page var $cur_page = 0; // The current page being viewed var $first_link = '‹ First'; var

how to switch database in codeigniter

别来无恙 提交于 2019-12-01 18:02:07
i'm new to CI and i just wanna know is there a way to switch databases in CI,Eg: In login Page, there's a dropdown list that you can specify which database you wanna connect with, view look like this <select name="select" id="select" > <option value="1">DB1</option> <option value="2">DB2</option> </select> And i got 2 databases in database.php one is default the other is local by default i'm using the default one. $active_group = 'default'; $active_record = TRUE; My question is how do i specify db based on the dropdown value, say if i pick DB1, connect to default one, DB2 goes to local one....

Create Unique field in Codeigniter DBForge Migration

六眼飞鱼酱① 提交于 2019-12-01 16:23:37
How can I make the financial_year field as unique using Codeigniter Dbforge migration? function up() { $this->dbforge->add_field(array( 'id' => array( 'type' => 'INT', 'constraint' => 11, 'unsigned' => TRUE, 'auto_increment' => TRUE ), 'financial_year' => array( 'type' => 'VARCHAR', 'constraint' => 20 ), 'start_date' => array( 'type' => 'DATE' ), 'end_date' => array( 'type' => 'DATE' ), 'status' => array( 'type' => "ENUM", 'constraint' => "'Active','Inactive'", 'default' => "Active" ), 'created_on' => array( 'type' => 'TIMESTAMP' ) )); $this->dbforge->add_key('id', TRUE); // add `id` as

CodeIgniter avatars uploading

[亡魂溺海] 提交于 2019-12-01 14:17:35
Here's the new HTML: <input type="file" name="file_1" /> <input type="text" name="image_description_1" class="text-input"/> Here's the new _submit function: if($this->CI->input->post('file_1')){ $config['overwrite'] = TRUE; $config['allowed_types'] = 'jpg|jpeg|gif|png'; $config['max_size'] = 2000; $config['upload_path'] = realpath(APPPATH . '../assets/uploads/avatars'); $this->CI->load->library('upload', $config); $this->CI->upload->do_upload(); $image_data = $this->CI->upload->data(); $image['description'] = $this->CI->input->post('image_description_1'); $image['user_id'] = $id; $image['image

CodeIgniter: setting flash data not working

泪湿孤枕 提交于 2019-12-01 12:14:33
I'm using the following code to manage pagination in search results: if ($this->input->post('search-notes') && (is_string($this->input->post('search-notes')) || is_string($this->input->post('search-notes')))): $this->session->set_flashdata('search-notes', $_POST['search-notes']); $post['search-notes'] = $this->input->post('search-notes'); elseif ($this->session->flashdata('search-notes')): $this->session->set_flashdata('search-notes', $this->session->flashdata('search-notes')); $post['search-notes'] = $this->session->flashdata('search-notes'); endif; if (isset($post['search-notes']) && is

codeigniter 2 htaccess routing differences

北城余情 提交于 2019-12-01 11:17:50
Codeigniter v2.0 that was released on the 28th. I just setup a fresh installation and tried to remove the index.php from the url. I am using the same apache site-available configuration, htaccess, and codeigniter configuration. Codeignter only loads the default controller defined in routes.php when I exclude the index.php. For example http://myurl.com/welcome will load the welcome controller http://myurl.com/events will load the welcome controller but http://myurl.com/index.php/events will load the events controller Here is my apache configuration for the site in question. <VirtualHost *:80>

Call to a member function num_rows() on a non-object

时光总嘲笑我的痴心妄想 提交于 2019-12-01 10:56:25
I'm using CodeIgniter, and I want to get some data from a table in a database. in my Model, I have this function : public function fetch_cours($limit, $start, $element) { $id_element = $this->db->from('element') ->where('name',$element) ->limit(1) ->get() ->result(); $query = $this->db->from('cour') ->where('id_element',(int) $id_element[0]->id) ->limit($limit, $start) ->get() ->result(); var_dump($query); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[] = $row; } return $data; } return false; } I want this function to return some records in the cour table. In my

codeigniter 2 and how to disabled xss for TinyMCE

ぐ巨炮叔叔 提交于 2019-12-01 09:11:50
ive searched every site including stackoverflow on this issue. I have XSS globally turned on and few pages I have use TinyMCE. On those pages I'd like the TinyMCE part to not have XSS enabled. After reading about 40 pages, they all say to do the following: $tiny_mce = $this->input->post('note'); // xss filtering off or $tiny_mce = $this->input->post('note', FALSE); // xss filtering off I have tried both, here is my model: public function edit($id) { $tiny_mce = $this->input->post('note'); // xss filtering off $userId = $this->ion_auth->get_user_id(); $data = array( 'note' => $tiny_mce ,