codeigniter

CodeIgniter: URIs and Forms

 ̄綄美尐妖づ 提交于 2020-01-01 07:12:27
问题 I'm implementing a search box using CodeIgniter, but I'm not sure about how I should pass the search parameters through. I have three parameters: the search string; product category; and the sort order. They're all optional. Currently, I'm sending the parameters through $_POST to a temporary method, which forwards the parameters to the regular URI form. This works fine. I'm using a weird URI format though: http://site.com/products/search=computer,sort=price,cat=laptop Does anyone have a

How do I import CSV to mysql using codeigniter

坚强是说给别人听的谎言 提交于 2020-01-01 06:56:43
问题 I have a list of csv files, which I want to be import to mysql db, using codeigniter. I tried $this->load->library('getcsv'); library but how to import the csv without uploading the CSV files to the server, what I meant was just uploading the files to a temp location like how pure coding PHP does. Any idea? Example: I wanted something like this. HTML: <input type="file" name="csv" /> to a temp string Codeigniter: $this->input->upload['tmp_name'] 回答1: I gave exactly the answer for this. Take a

Looking for tutorial on how to build a private messaging system using PHP [closed]

坚强是说给别人听的谎言 提交于 2020-01-01 06:55:35
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Looking for tutorial on how to build a secure private messaging system using PHP. Would be much appreciated.. So far I've been following this one http://www.astahost.com/Private-Message-System-t18247.html Not really liking the way it's structured though. I would appreciate if anyone could point me to a nice

CodeIgniter and AJAX form submit

跟風遠走 提交于 2020-01-01 06:42:25
问题 I am trying to save data submitted from a form into my mysql database and and then update the div element with the last posted item prepended to the list in the div. Right now I am only trying to get a response back, I'm not worried about having the formatting correct at the moment. My problem is the form won't submit with e.preventDefault(); in place, but without it the form does the normal method of posting to the db then refreshing the page. Here is my AJAX call: $(document).ready(function

Creating a database-generated menu on every page in CodeIgniter?

梦想的初衷 提交于 2020-01-01 06:12:48
问题 I'm using CodeIgniter and have a menu on the site that needs to read a list of cities from the database. This is simple to do if it's just on one or two pages - I load the model and call a function from the controller, and pass the data into the view. But if I want it on every page, that means I have to keep copying the same code to every single controller function and pass the data into the view. (Note, I'm using a separate "header" view that contains the menu.) What's the best way to

CodeIgniter/PHP - Calling a view from within a view

隐身守侯 提交于 2020-01-01 06:12:14
问题 Basically for my webapp I'm trying to organise it a bit better. As it at the moment, every time I want to load a page, I have to do it from my controller like so: $this->load->view('subviews/template/headerview'); $this->load->view('subviews/template/menuview'); $this->load->view('The-View-I-Want-To-Load'); $this->load->view('subviews/template/sidebar'); $this->load->view('subviews/template/footerview'); As you can tell it's not really very efficient. So I thought I'd create one 'master' view

Code Igniter - remove single quotes from where_in

有些话、适合烂在心里 提交于 2020-01-01 05:54:10
问题 I have 2 queries: $genres = $this->db->select('Group_Concat(intGenreId) strDJGenres') ->from('tblDJGenres') ->where('intDJId', $this->session->userdata('non_admin_userid')) ->get() ->row(); $results = $this->db->select('tblTracks.*, tblGenres.strName as strGenreName') ->from('tblTracks') ->join('tblGenres', 'tblTracks.intGenreId = tblGenres.intGenreId', 'left') ->where_in('tblTracks.intGenreId', $genres->strDJGenres) ->get() ->result(); The first query is returning a string such as '1,2,3,4,8

How Do You Create Multiple Instances of a Library Class in CodeIgniter?

纵饮孤独 提交于 2020-01-01 05:44:26
问题 I'd like to create several instances of a class in CodeIgniter. I have created my class as a library, but cannot figure out the syntax to use to create more than one instance. 回答1: From the CodeIgniter users guide: CI Users Guide: Loader Class Assigning a Library to a different object name If the third (optional) parameter is blank, the library will usually be assigned to an object with the same name as the library. For example, if the library is named Session, it will be assigned to a

Error: You must use the “set” method to update an entry fix?

倖福魔咒の 提交于 2020-01-01 05:43:13
问题 I am using codeigniter as my PHP framework, and I keep getting this error when I submit my from to post to my database. You must use the "set" method to update an entry I am not exactly sure what that means, from the other posts I have looked at, everyone says that the datamapper needs to have a value assigned to the object. Being that I am new to all this, could someone give me a better explaniation. Here is my code where it says I have the error: class Add_book extends CI_Model { public

Ajax CSRF 403 forbidden codeigniter

时间秒杀一切 提交于 2020-01-01 05:35:12
问题 Hello I am calling controller to get section using AJAX in my codeigniter based app which have CSRF Enable my ajax code $('#classes').change(function(){ $classes=$(this).val(); $.ajax({ type:"POST", data:{ '<?php echo $this->security->get_csrf_token_name(); ?>' : '<?php echo $this->security->get_csrf_hash(); ?>', 'class':$classes }, url:"<?php echo base_url();?>index.php/admin/getsection/"+$classes, success:function(return_data) { //alert(return_data); $('#section').html(''); $('#section')