codeigniter

Codeigniter: Order by ascending date

孤街浪徒 提交于 2019-12-22 14:01:08
问题 Hi this is my model code for ordering and getting the data: $this->db->order_by($oBy, "asc"); $query = $this->db->get('books'); Everything is working fine, however in my database i am storing the date as a string, e.g. 01-Jan-2014. Therefore when i order the date it will order it by the day and not year, may i know how can i solve it by sorting by the year, however the data will still display out as 01-Jan-2014 and also it will be displayed in ascending order? Thank you! Error: 回答1: $this->db

Codeigniter: using datagrid

别等时光非礼了梦想. 提交于 2019-12-22 13:57:08
问题 i'm looking for implement datagrid with CI, better if using ajax. Searching on Google i've found many tutorial and discussion on how to use Flexigrid-4-CI or jqGrid , anyway i'm still confused on which one could offer more flexibility. For example, is it possible to set more than one field to filter results with Flexigrid? Besides extending my search i found other libraries such as CarboGrid or datagrid-CI. Does anyone tried that stuff? What's your suggestion? CarboGrid looks really

Codeigniter Cart - saving data in database - how to approach?

此生再无相见时 提交于 2019-12-22 12:46:27
问题 I need help with handling orders and cart in my web application. I decided to use Cart library built in Codeigniter 2. I've seen some tutorials about that Cart library and i know how to use it, but i dont know: when shall I create/save that order in database? when user is adding items to cart, or shall i keep all order data in session and "move" it do database when user accepts order? shall I store session id or something other in database? I tried to see how cart/order functionality is

css not loading in codeigniter

ⅰ亾dé卋堺 提交于 2019-12-22 12:39:33
问题 I have this code <link href = "<?php echo base_url(); ?>css/style.css” rel=”stylesheet" type="text/css" /> which supposed to load the style.css from the css folder. The echo base_url() itself works. I also have autoloaded the url helper , so i really don't see the problem here, but it still doesn't load. 回答1: Also make sure that the directory is not "blocked" by the .htaccess file, if you are using it to remove index.php RewriteEngine on RewriteCond $1 !^(index\.php|css|robots\.txt)

Codeigniter Dynamic Routing

孤街浪徒 提交于 2019-12-22 12:38:05
问题 Hi i wont to make something like that. http:// example.com/ - Main Controller http:// example.com/rules/ - Main Controller where content get from database, but if not exist return 404 page. (It's ok, isn't problem.) But if i have subfolder in application/controlles/rules/ I want to redirect it to Main Contorller at Rules folder. This follow code can solve problem, but i don't know how it right realise. At routes.php: $route['default_controller'] = "main"; $route['404_override'] = ''; $dirtest

Codeigniter MSSQL/SQLSRV Connection

拥有回忆 提交于 2019-12-22 12:35:11
问题 I'm working on a web app that connects to a MSSQL database. I previously managed to connect to the database without any problems, however I made a minor change to the sqlsrv_driver file. I encountered the below error, rolled my changes back to the original file, but there are still issues. I have ensured that I have relevant MS drivers installed, correct port number used, etc however its returning this error: Unable to connect to your database server using the provided settings. Filename: D:.

multi level menu from database in codeigniter

扶醉桌前 提交于 2019-12-22 12:27:47
问题 I have a table in my database containing all of my database categories, which I need to convert into a multi-level menu. The table structure is below: product_category_id | product_category_name | product_category_description | product_category_parent_id -------------------------------------------------------------------------------------------------------- 1 test ulghjbjjjh NULL 2 test2 yruktghkug NULL 3 test sub 1 yr5y346uij 1 4 test sub sub 1 yfghvbnhtd 3 Using the functions I have adapted

Calling/invoking a hook manually in Codeigniter

↘锁芯ラ 提交于 2019-12-22 12:23:58
问题 I searched for calling/invoking a hook manually and similar stuff on the web but couldn't find anything. Is there a such thing in codeigniter? I have a hook below which gets triggered as expected but just in case if doesn't, then I want to invoke it manually in my code. Thanks $hook['post_controller_constructor'] [] = array( 'class' => 'load_designs', 'function' => 'do_load', 'filename' => 'load_designs_hook.php', 'filepath' => 'hooks', 'params' => '' ); 回答1: In order to call a hook, you

AngularJS | How to Send the Data of Json to database in Codeigniter

血红的双手。 提交于 2019-12-22 12:19:51
问题 I am trying to use Angular. I am trying to Post Form of Angular, which have been done successfully, it is posting in JSON, But Problem is it only Post the input fields which have values, if i have NOT filled a textbox then it will NOT post that textbox value and fieldname, so how to know in controller which input fields have been posted. Also how to send it to the model?? Here what i have done so far. View. <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/html"> <head> <link href="<?php

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',