codeigniter

Passing data to server using JSON in Codeigniter

泄露秘密 提交于 2020-01-06 12:57:18
问题 I'm trying to pass some data which is stored in Javascript array to the server for database processings. I'm using codeignier. Javascript Array (unitdata_set):- [{"unit_id":"13","unit_title":"Testsdsdf","unit_max_occupancy":"3","unit_no":"1","unit_no_adults":"1","unit_no_children":"1","unit_no_extrabed":0,"unit_mealtype":"Full Board","unit_fullboard_adult":"6000.00","unit_fullboard_child":"4000.00","unit_halfboard_adult":"1800.00","unit_halfboard_child":"1200.00","room_total":"81600.00","all

MYSQL Syntax error - Codeigniter function to calculate cost

半腔热情 提交于 2020-01-06 12:55:28
问题 function stationcost($station1,$station2) { $data = array(); $this->db->select('Zone')->from('station_zone')->where('Station', $station1); $Q = $this->db->get(); $this->db->select('cost')->from('zone_cost')->where('zone', $Q); $query = $this->db->get(); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data = $row->Cost; return $data; } } } If i change $Q to an integer, the function works correctly. I'm yet to add another station to minus the difference to calculate the zone

Dynamic Folders in Uploadfive with CodeIgniter

时间秒杀一切 提交于 2020-01-06 12:55:13
问题 I started using uploadifive for file uploads. I am trying to create a dynamic folder into which the uploaded files will be saved. The folder is being created. but i cant upload the files into that folder. This the view page: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>UploadiFive Test</title> <script src="<?=base_url()?>application/views/Sample/jquery.min.js" type="text/javascript"></script> <script src="<?=base_url()?>application

Pagination with Codeigniter, without index function

我是研究僧i 提交于 2020-01-06 12:38:38
问题 I have a controller for example: class Users extends CI_Controller { function index() { $this->load->library('pagination'); $config['base_url'] = base_url() . 'index.php/users'; $config['total_rows'] = 55; $config['per_page'] = 10; $this->pagination->initialize($config); echo $this->pagination->create_links(); } } Then the pagination will be: base_url() . 'index.php/users/10 base_url() . 'index.php/users/20 base_url() . 'index.php/users/30 .. THE PROBLEM It displays the links fine, but when I

Dynamically set language with CodeIgniter

会有一股神秘感。 提交于 2020-01-06 12:26:08
问题 I want to set the default application language as my visitor countries language. I have an API to get the IP prefix idiom and based in this information, I want to set the language. What is the best way to do this? I want to make a cookie to store the language identifier, but where do I have to set this? Thanks. 回答1: Have you seen CodeIgniter's Language library? The Language Class provides functions to retrieve language files and lines of text for purposes of internationalization. In your

.htaccess not working on codeigniter subdomain & directory install

独自空忆成欢 提交于 2020-01-06 12:08:31
问题 I am trying to install CI under a directory which is also on a subdomain. So my base url would look like http://subdomain.domain.com/ci/ The following htaccess works fine on root of domain but not on directory, the browser says there is a redirect loop error. Here is my code: RewriteEngine on RewriteCond %{HTTP_HOST} !^sub\.domain\.com/ci/$ RewriteRule ^(.*)$ http://sub.domain.com/ci/$1 [L,R=301] RewriteCond $1 !^(index\.php|assets) RewriteRule ^(.*)$ /index.php?/$1 [L] I am not very skilled

.htaccess not working on codeigniter subdomain & directory install

[亡魂溺海] 提交于 2020-01-06 12:08:12
问题 I am trying to install CI under a directory which is also on a subdomain. So my base url would look like http://subdomain.domain.com/ci/ The following htaccess works fine on root of domain but not on directory, the browser says there is a redirect loop error. Here is my code: RewriteEngine on RewriteCond %{HTTP_HOST} !^sub\.domain\.com/ci/$ RewriteRule ^(.*)$ http://sub.domain.com/ci/$1 [L,R=301] RewriteCond $1 !^(index\.php|assets) RewriteRule ^(.*)$ /index.php?/$1 [L] I am not very skilled

Codeigniter - banner page choose file php errors

老子叫甜甜 提交于 2020-01-06 11:46:56
问题 I am new in CodeIgniter, I'm making an admin panel for all static pages, option is user click on choose file and select a file click to update banner and its uploaded and display on page but when i directly click on Update Banner button so it shows an php error, now i want to know two things first how I will rectify this error secondly is there any alert thing here so i mention the user to first upload file then click update banner button, please suggest i already provide php errors & coding

Unable to access assets folder in Codeigniter

孤街醉人 提交于 2020-01-06 09:57:30
问题 My directory structure is as follows: -application -system -assets --images --downloads --css index.php I created assets as suggested on stackoverflow ,I wanted to restrict access to downloads so placed .htaccess file in assets folder with the following directive Deny from all now its protected but as assets has css files and those are also not accessible too. 回答1: Try to put the htaccess file to downloads file 来源: https://stackoverflow.com/questions/18316445/unable-to-access-assets-folder-in

Unable to access assets folder in Codeigniter

情到浓时终转凉″ 提交于 2020-01-06 09:56:31
问题 My directory structure is as follows: -application -system -assets --images --downloads --css index.php I created assets as suggested on stackoverflow ,I wanted to restrict access to downloads so placed .htaccess file in assets folder with the following directive Deny from all now its protected but as assets has css files and those are also not accessible too. 回答1: Try to put the htaccess file to downloads file 来源: https://stackoverflow.com/questions/18316445/unable-to-access-assets-folder-in