codeigniter

How can I display my database queries in the Codeigniter Profiler when I load my databases in my models?

僤鯓⒐⒋嵵緔 提交于 2020-01-01 11:36:09
问题 My Codeigniter system uses multiple databases. I don't need every database on every page, so I load each connection in the model where it's needed, then load the required models within each controller. The profiler does not display any of the queries from these databases when I load things this way. This is how I load the databases in my models: $this->Companies_db = $this->load->database( 'companies', TRUE, TRUE ); I used to load all my databases in MY_Controller() ( an extension of the core

How to send an array via the url in javascript/jQuery

核能气质少年 提交于 2020-01-01 11:03:07
问题 I am trying to send a javascript array via the url.But it fails function viewReport(mode,someid){ if(mode==0){ var para= new Array(); para['para1'] = 'para1'||0; para['para2']= 'para2' || 0; console.log(para); window.open('somePDFView/'+para,'_blank'); }else{ var para=[]; var paraelements={ para1:'anotherpara1'||0, para2:'anotherpara2'||0 }; para[0]=paraelements; window.open('somePDFView/'+para,'_blank'); } } On if part(mode=0) , the para array is not sending any more and on else part ( mode

How to send an array via the url in javascript/jQuery

戏子无情 提交于 2020-01-01 11:02:10
问题 I am trying to send a javascript array via the url.But it fails function viewReport(mode,someid){ if(mode==0){ var para= new Array(); para['para1'] = 'para1'||0; para['para2']= 'para2' || 0; console.log(para); window.open('somePDFView/'+para,'_blank'); }else{ var para=[]; var paraelements={ para1:'anotherpara1'||0, para2:'anotherpara2'||0 }; para[0]=paraelements; window.open('somePDFView/'+para,'_blank'); } } On if part(mode=0) , the para array is not sending any more and on else part ( mode

Rewriterule for CodeIgniter not working

主宰稳场 提交于 2020-01-01 10:48:11
问题 I have installed a clean Apache2 (plus PHP & MySQL) server and enabled the mod_rewrite in the apache config. I added the .htaccess file to remove the index.php from the url as described in the CodeIgniter wiki. RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] I placed this file in the website's root. When I try to access the url mydomain.local/index.php/welcome then I get the default page of CodeIgniter. But when I try to access the same

INSERT Batch, and if duplicate key Update in codeigniter

别等时光非礼了梦想. 提交于 2020-01-01 09:59:02
问题 Is there any way of performing in batch Insert query and if the key already exists, UPDATE that row in codeigniter? I have gone through the documentation and found only insert_batch and update_batch. But how to update the row with duplicate key in active records? And what happens if one row fails to be inserted or updated in batch_insert? All insertion fails or only that row? 回答1: You will have to go with little custom query by adding "ON DUPLICATE" statement $sql = $this->db->insert_string(

INSERT Batch, and if duplicate key Update in codeigniter

淺唱寂寞╮ 提交于 2020-01-01 09:58:28
问题 Is there any way of performing in batch Insert query and if the key already exists, UPDATE that row in codeigniter? I have gone through the documentation and found only insert_batch and update_batch. But how to update the row with duplicate key in active records? And what happens if one row fails to be inserted or updated in batch_insert? All insertion fails or only that row? 回答1: You will have to go with little custom query by adding "ON DUPLICATE" statement $sql = $this->db->insert_string(

How do I upload .docx using Codeigniter? (PHP)

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 09:43:33
问题 I'm attempting to upload a .docx using the upload helper in Codeigniter. public function upload($id,$type){ $folder = $type; $config['upload_path'] = RESOURCE_PATH . $folder; $config['allowed_types'] = 'pdf|doc|docx'; $config['max_size'] = '100000'; $this->CI->load->library('upload',$config); //$this->load->library('upload', $config); if (!$this->CI->upload->do_upload('userfile')){ echo $this->CI->upload->display_errors(); } .... The upload function works fine on my local host. However, when

Codeigniter auth key for REST service

大兔子大兔子 提交于 2020-01-01 08:27:17
问题 I'm writing a simple RESTful service, using Phil Sturgeon Rest Server. I want to protect my methods by using the API key provided with this library. Unfortunately, this is not very well documented and I'm a bit lost. I want to authenticate users (email/password), then generate an auth key to send on every other requests. But it seems that I already need the auth key to generate one ... Create a dummy key does not seem very secure. Sorry if it is a dumb question, but what should be the best

Doctrine undefined function apc_fetch

左心房为你撑大大i 提交于 2020-01-01 08:17:28
问题 I'm using this tutorial, which gives a detail explanation about how to set up CodeIgniter and Doctrine. I'm using CodeIgniter 2.1.0 and Doctrine 2.2.1, but I get this error: Fatal error: Call to undefined function Doctrine\Common\Cache\apc_fetch() in /Applications/XAMPP/xamppfiles/htdocs/emma_watson_shrine/application/libraries/Doctrine/Common/Cache/ApcCache.php on line 52 Can you help me out? 回答1: You need to enable the APC extension for PHP. Follow this guide. Alternatively, you could use a

Cross-Origin Resource Sharing policy blocking glyphicons from Bootstrap in CodeIgniter application

感情迁移 提交于 2020-01-01 07:24:05
问题 I'm trying to use the glyphicons provided by Bootstrap 3.3.6 but Chrome is blocking the access to them with this error message: Font from origin 'http://[::1]' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. This is my .htaccess : <IfModule authz_core_module> Require all denied </IfModule> <IfModule !authz_core_module> Deny from all <