codeigniter-2

Bulk Exporting Data from Codeigniter to CSV using Database Utility Class

流过昼夜 提交于 2019-12-22 11:56:55
问题 Here is my code: function export_csv() { $st = $this->input->get('st'); //Start Date $en = $this->input->get('en'); //End Date $sTable = 'TABLE_NAME'; $this->load->dbutil(); $aColumns = array('tempdisplayid AS ucid','uui','campaign_name','location','caller_id','skill','calltime','answertime','TIMEDIFF(answertime,calltime) as timetoanswer','endtime','talktime','duration','fallback_rule','dialed_number','type','agent','agent_did','disposition','status','hangup_by','transfer','transfer_to',

Mysql codeigniter php asc desc order by count result using php

老子叫甜甜 提交于 2019-12-22 10:23:57
问题 I have three tables named: at_category: cat_id name at_category_taxonomy: cat_taxonomy_id cat_id taxonomy at_shop: shop_id shop_category I want to join those three tables by counting result. For example the category named as Electronic Shops in at_category table and the value will be stored in at_category_taxonomy table and the this category id's are having two shops in at_shop table. same as for remaining categories aaa, bbb, ccc etc...it may be having one or two shops else zero shops.

CodeIgniter call same function for all controllers

て烟熏妆下的殇ゞ 提交于 2019-12-22 09:48:36
问题 I'm developing an application, where the same function I'm writing for some controllers. So I wanted one common function for all controllers. Please help me out I've stucked up with this. The work would be more appreciated. 回答1: You can develop a helper or library. codeigniter version 2 : https://codeigniter.com/userguide2/general/creating_libraries.html codeigniter version 3 : https://codeigniter.com/user_guide/general/creating_libraries.html?highlight=library 回答2: You can create MY

Restrict the url_suffix in codeigniter

无人久伴 提交于 2019-12-22 08:48:58
问题 I am using codeigniter 2.1.4 and I have set $config['url_suffix'] = ".html"; It's working fine with out any trouble. But I found out that if I use redirect(); function will always add url_suffix on the landing page url. eg: site.com/login/success.html . My question is there anyway to exclude the url_suffix while using the redirect() function? or is there anyway to add .html without setting url_suffix in codeigniter, may be some hack in .htaccess?? I tried to add RewriteEngine On RewriteCond %

How to get form_dropdown() show the selected value in Codeigniter?

女生的网名这么多〃 提交于 2019-12-22 07:56:27
问题 I am trying to populate a dropdown list from database. In my view file I have the following code $batch= $query ['batch']; // I pull this data from a separate model echo form_dropdown('shirts', $options, $batch); Now the drop down list is populating data fine but the problem is I don't get the value-"$batch" automatically selected when the page loads. Interestingly if I echo $batch, elsewhere in the page it shows the correct data, which means $batch is okay. Here is my Controller function

codeigniter + require letters and numbers in password

独自空忆成欢 提交于 2019-12-22 06:02:21
问题 I'd like to use form validation to require a password that has BOTH alpha and numeric characters. Here's what I've come up with so far: $this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]|min_length[8]|alpha_numeric'); The issue is that "alpha_numeric" requires that the password only contain letters or numbers, it doesn't require both. Going for the stronger password option here. 回答1: You could set up a callback in your controller: public function password

codeigniter + require letters and numbers in password

北战南征 提交于 2019-12-22 06:02:06
问题 I'd like to use form validation to require a password that has BOTH alpha and numeric characters. Here's what I've come up with so far: $this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]|min_length[8]|alpha_numeric'); The issue is that "alpha_numeric" requires that the password only contain letters or numbers, it doesn't require both. Going for the stronger password option here. 回答1: You could set up a callback in your controller: public function password

Why is CIUnit needed in order to use PHPUnit with CodeIgniter?

三世轮回 提交于 2019-12-22 05:57:50
问题 We've decided to use PHPUnit (with Jenkins) in our next project. We're considering different PHP frameworks, one of which is CodeIgniter. I see that a lot of people use My CIUNIT to "bridge" PHPUnit and Codeigniter. There is little to no explanation in the online documentation. Why is it needed? Other frameworks don't seem to need a "cool bridge" like this. 回答1: Reasons: Codeigniter's components are tightly coupled. You need some big basic parts running (the loader, the router, the CFG object

CodeIgniter DB Session problems: sess_expire_on_close

為{幸葍}努か 提交于 2019-12-21 20:36:37
问题 I've encountered a very odd problem with CI's session when stored in the DB. I'm using sessions to store information about whether or not a user is logged in on my site. For some reason, a friend of mine from Lithuania (I mention the country in case it's relevant somehow) could not log in. When I monitored the session table, it seemed like she was creating a new session for each page she went to. She tried using various browsers, but the same problem occurred regardless of browser. No one

Codeigniter multiple views in one view

南楼画角 提交于 2019-12-21 13:26:11
问题 I am working on a web application. This might be a silly question, but I want to know whether I am taking the good approach to this or not. I want to have multiple views on one single view/page. The Codeigniter documentation says that "A view is simply a web page, or a page fragment, like a header, footer, sidebar, ...". I want to have a header, some quick search view, some other view and a footer for a example. Should I implement a controller to every view (header, quick search, footer, ...)