codeigniter-2

codeigniter active record where, or_where?

笑着哭i 提交于 2019-12-01 01:59:12
问题 I am using Active Record on CodeIgniter. I am confused on which approach I should take. Currently, our login system let's the user to use username/email for the login along with the password. But my current active record, seems to let the user logged in if he choose to use the email + no password. Right now this is my query: $this->db->select('id,level,email,username'); $this->db->where('email',$user); $this->db->or_where('username',$user); $this->db->where('password',$pass); $query = $this-

CodeIgniter: Parse dynamic language captions located in javascript

白昼怎懂夜的黑 提交于 2019-11-30 23:21:05
I have a javascript code that needs localisation, ie. function js_proc() { var some_data = 'this text needs to be translated dynamically at runtime'; } So I re-wrote like this: function js_proc() { var some_data = <?php echo $this->lang->line('some_data_id'); ?>; } In the view, I wrote the js link like this: <script type="text/javascript" src="www.domain.com/codeigniter/get_js/file-1/"></script> which calls the function get_js() in the controller. The idea is to have the get_js() function read the js file(s) and translate the language strings... There are way too many js strings to be

Codeigniter - Batch Update with Multiple Where Conditions

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 22:17:41
问题 For starters, the Codeigniter documentation on update_batch does not exist. kenjis was kind enough to provide some documentation and submit it to the repository. Hopefully they pull it soon. Does anyone know how to add multiple where conditions to Codeigniters update_batch command? My Desired Use: $where = array( 'title', 'name' ); $this->db->update_batch('mytable', $data, $where); When I tried this code I got the follow error: A Database Error Occurred One or more rows submitted for batch

Running multiple queries in model in codeigniter

試著忘記壹切 提交于 2019-11-30 21:43:06
I have this code in model in codeigniter: <?php Class Mymodel Extends CI_Model { function __construct() { parent::__construct(); } function search($textinput) { $street = "select street from dataSearch;"; $stripNameWOSpace = "select stripNameWOSpace FROM dataSearch;"; $vowels = array('a','e','i','o','u',';','/','-', ' '); $string = strtolower($textinput); $strippedVowels = mysql_real_escape_string(str_replace($vowels, '', $string)); $this->db->query("select dataSearch.id, dataSearch.name, dataSearch.street, dataSearch.city, dataSearch.lat, dataSearch.lng, category.asiatype from dataSearch join

CodeIgniter + CSS

天涯浪子 提交于 2019-11-30 20:14:40
Good Day, I'm learning CodeIgniter with Smarty. My CSS file is stored in /App01/application/views/css/main.css To link my CSS I use: <link rel="stylesheet" type="text/css" href="http://localhost:88/APP1/application/views/css/layout.css" media="screen" /> But CSS is not applied on my page. When I open CSS URL, I get a message: Forbidden You don't have permission to access /APP1/application/views/css/layout.css on this server. Please, what am I doing wrong? I'd like to keep my CSS together with the view because in future I'd like to learn how to create multiple themes and I thing the CSS should

CodeIgniter incorrect system path on private server

▼魔方 西西 提交于 2019-11-30 17:46:04
问题 codeigniter project when uploaded to server gives me the following error. Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php it is working well locally & on 000webhost.com hosting. When uploaded to private server of parallels it gives the above error. My index.php is as follows. <?php define('ENVIRONMENT', 'development'); if (defined('ENVIRONMENT')) { switch (ENVIRONMENT) { case 'development': error_reporting(E_ALL); break;

CodeIgniter list-fields

a 夏天 提交于 2019-11-30 17:10:13
问题 I'm using CodeIgniter 2.1.3. I have problem with function list_fields() which should return an array of fields of the MySQL result. So my code below should list all fields of the MySQL result. $query = $this->db->query("SELECT * from $tablename where REGNO='$keyword' " ); $fields = $query->list_fields(); foreach ($fields as $f) { echo $f; } It works fine in Windows but it is not working in Linux, but if the number of rows are zero in results, it works even in Linux. Any idea what's going

CodeIgniter + CSS

偶尔善良 提交于 2019-11-30 16:58:55
问题 Good Day, I'm learning CodeIgniter with Smarty. My CSS file is stored in /App01/application/views/css/main.css To link my CSS I use: <link rel="stylesheet" type="text/css" href="http://localhost:88/APP1/application/views/css/layout.css" media="screen" /> But CSS is not applied on my page. When I open CSS URL, I get a message: Forbidden You don't have permission to access /APP1/application/views/css/layout.css on this server. Please, what am I doing wrong? I'd like to keep my CSS together with

Pagination do not correct display page numbers Codeigniter

不问归期 提交于 2019-11-30 15:43:46
问题 My controller function function test($start_from = 0) { $this->load->library('pagination'); $data = array(); $per_page = 3; $total = $this->activity_model->count_by(); $config['base_url'] = base_url() . 'test'; $config['total_rows'] = $total; $config['per_page'] = $per_page; $config['uri_segment'] = 2; $config['num_links'] = 2; $config['use_page_numbers'] = TRUE; $data['follow'] = $this->activity_model->get($per_page, $start_from); $this->pagination->initialize($config); $data['pagination'] =

Pagination do not correct display page numbers Codeigniter

我们两清 提交于 2019-11-30 14:57:15
My controller function function test($start_from = 0) { $this->load->library('pagination'); $data = array(); $per_page = 3; $total = $this->activity_model->count_by(); $config['base_url'] = base_url() . 'test'; $config['total_rows'] = $total; $config['per_page'] = $per_page; $config['uri_segment'] = 2; $config['num_links'] = 2; $config['use_page_numbers'] = TRUE; $data['follow'] = $this->activity_model->get($per_page, $start_from); $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $this->load->view('front_end/test' ,$data); } my route : $route[