codeigniter-2

Two field as one unique field in Grocery Crud

主宰稳场 提交于 2019-12-06 09:39:38
I have one problem in GroceryCrud. I want to insert the data in one table. Table is like this: id, card_no, site_code, site_no card_no is unique and i have implemented it. However; my problem is that site_code and site_no should be unique only is both values match. Which means that is site_code is 101 and site_no is 102 and we try to insert identical values for both again is should reject it. If we one of the values is different it should allow it. In this case we are treating both values as one when we insert it. I hope I'am clear. Thanks in advance. Apart from your table design login, you

Bulk Exporting Data from Codeigniter to CSV using Database Utility Class

淺唱寂寞╮ 提交于 2019-12-06 09:37:44
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','comments','dial_status','customer_status','agent_status','audio','AgentStatus','CustomerStatus','user

How to remove the single cart item using codeigniter cart class?

爱⌒轻易说出口 提交于 2019-12-06 07:21:56
问题 I am using codeigniter cart class for my shopping cart project. I have number of items on the cart. Now I do have cart row id. Now what exactly i need to do is, need to remove the particular item from the cart not all the contents(Destroying cart). $cartcontents = $this->cart->product_options($rowid); and unseting all contents. but doesn't works out. Please do help you anybody have an idea. Thank You. 回答1: $data = array( 'rowid' => '30ef30b64204a3088a26bc2e6ecf7602', 'qty' => 0 ); $this->cart

Routes not working when uploaded to server (CodeIgniter)

允我心安 提交于 2019-12-06 07:13:50
I created a site on CodeIgniter and everything works fine on XAMPP. But when I upload my file to the server the routes stopped working. I'm getting 404 URL not found error on all the page except the index page. here is my routes. $route['default_controller'] = "onlinec"; $route['404_override'] = ''; $route['home'] = 'serial/home/'; $route['done'] = 'serial/done/'; $route['redeem'] = 'serial/redeem/'; $route['printpage'] = 'serial/printpage/'; $route['login'] = 'serial/auth/login'; $route['logout'] = 'serial/auth/logout'; here is my .htaccess <IfModule mod_rewrite.c> RewriteEngine On

How to override config's array within a controller in CodeIgniter?

喜夏-厌秋 提交于 2019-12-06 05:28:17
I have a file app/config/template.php : $config['head_meta'] = array( 'charset' => 'UTF-8', 'description' => '', 'keywords' => '', 'stylesheets' => array( 'template.css' ), 'scripts' => array( 'plugins/jquery-2.0.3.min.js', 'plugins/bootstrap.min.js' ), 'end_scripts' => array( 'template.js' ) ); I need to override that description inside my controller's function app/controllers/pages.php : function contact($pagename = 'Contact', $slug = 'contact'){ // load dependencies $this->load->library('form_validation'); $this->lang->load($slug); // page settings $this->config->set_item('page_name', $this

dompdf not rendering images from the server but is rendering from external source

Deadly 提交于 2019-12-06 05:23:25
I'm trying to figure this out for the last few days now and come up with nothing. I have dompdf working on my server and its creating the pdf fine. The only issue is its not rending the images I send to it. I have DOMPDF_ENABLE_REMOTE set to TRUE, tmp folder is writable and get_file_contents is turned on. Now the sample that you get in the dompdf folder renders the remote images fine it just seems to be images file from my server that's causing the issue. I've tried absolute and relative urls. I'm running this through codeigniter, and its the beta version 0.6.0. This is my helper: function

PHPExcel - Create spreadsheet from HTML table?

主宰稳场 提交于 2019-12-06 05:13:29
问题 I'm trying to create a simple reporting system, which can output either HTML or export to Excel. I have got it to create a HTML table successfully through a Codeigniter view but I want to know if there's any way I can re-use that view to create the Excel export, rather than doing it manually, as I'll then have to update it in two places every time I want to make a change to the report. Any advice appreciated. Thanks. 回答1: This seems to be working: // Load the table view into a variable $html

CodeIgniter ActiveRecord join() method wrapping numbers with backticks

吃可爱长大的小学妹 提交于 2019-12-06 05:12:59
This is my active record code in CodeIgniter: $this->db->... $this->db->join('post_likes', 'post_likes.user_id="'.$this->db->escape($online_user).'" AND post_likes.post_id=post.id', 'left'); And this is how it is interpreted: LEFT JOIN `post_likes` ON `post_likes`.`user_id`="`3"` AND post_likes.post_id=post.id it gives the error: `user_id`="`3"` How to write a direct number in active record? Update: removing escape to test it on your computer you dont need to have a database. Just trying this code shows the error: $this->db->select('*') ->from('mytable') ->join('post_likes', 'post_likes.user

Codeigniter catch database errors

≯℡__Kan透↙ 提交于 2019-12-06 03:34:00
I'm looking for a way to catch all the database errors (if and when they occur) and sent an error report my email. For regular php error I extended the CI_Exceptions class and added my email sending code in addition to logging. But the database errors don't go trough CI_Exceptions but instead are logged directly from CI_DB_Driver->query() and I don't want to modify any file in the System folder. Also I don't want to write logging code around every query the app does. I'd be tempted to extend CI_Exceptions show_error method to catch any errors passed with the 'error_db' template rather than

Extending Multiple models in Codeigniter 2

谁说我不能喝 提交于 2019-12-06 03:25:03
问题 How do you set up CI2 to allow extending of multiple models? I can only get it to extend one model (put in /application/core) named MY_Model (case sensitive). To choose what model to extend I am doing; in the model.. require_once APPPATH.'core/MY_Another_model.php'; class Test_model extends MY_Another_model { ... } I can't find where in the core system code where it states only to allow models that are being extended to be called MY_Model. Thank you for any and all help. 回答1: As I said in