codeigniter

using session library in CodeIgniter

For some reason I'm heaving a tough time understanding how sessions in CI work. I would like to change the following part of the code to use CodeIgniter sessions rather than the way it's normally done in PHP. What would be the best way to do it? foreach($_POST['qty'] as $k => $v) { $id = (int)$k; $qty = (int)$v; $_SESSION[...

Codeigniter - how to use the foreign keys from one table to look for the id's of another table.

I'm having a problem trying to wrap my head around how to query the database to retrieve the foreign keys in my Nav table and then using those to find the id's in the NavItem table. Can someone point me in the right direction or give me some pointers? i'm not even sure if this should be done in the model or the controller! Thanks in adv...

RSS feed doesnt display items. Only title

So i just made my first RSS feed, or so i tought, in combination with CI. Now my view DOES display the top of my rss page (Title and Description), But all items are omitted. When i rightclick->view source it DOES contain all the items within the item tags. Can anyone help me? View (rss.php): <?php echo '<?xml version="1.0" encoding="...

Codeigniter image upload not working

I can't get my images to upload no matter what i do. Below is the code that is in my model: function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('up...

Codeigniter: Profiling and Performance

I'm new to app development and CI as a whole, so I've got an oodle of questions. What is profiling? How is it used? How does it work? What is considered a "long" time? More importantly, How do I use it to improve performance? The reason I'm asking is b/c my app is really sluggish right now. ...

Codeigniter: how to track activity w/o using multiple db rows?

I need to track the completion of tasks for users. I started by having a row called "first_login", "profile_complete", "other_thing_complete", etc... I'd like to combine these all into one row "activity_state". I just don't know how to properly store data in this field, and how to retrieve it. What kind of field should it be, and how...

MYSQL multiple insert in codeigniter

Hi everyone, I know about the possibility of making a multiple insert in mySQL by doing something like this: foreach ($array as $manuf) { $sql[] = '("'.mysql_real_escape_string($manuf['name']).'", "'.$manuf['lang'].'", "'.$mId.'")'; } $this->db->query('INSERT INTO manufacturers (name, lang ,mid) VALUES ' . impl...

Codeigniter: simple form function

I'm stuck writing a simple form...I feel dumb. Here's my controller: function welcome_message(){ //Update welcome message $id = $this->session->userdata('id'); $profile['welcome_message'] = $this->input->post('welcome_message'); $this->db->update('be_user_profiles',$profile, array('user_id' => $id)); } And the ...

Codeigniter: Count columns with value for user

How do I get a count of columns where('user_id', $id)...? ...

Codeigniter: Count columns not NULL for user

I just asked this question, but failed to specify that I would like to get the number of fields that actually have a value. I need to know how many fields have something in them, so I can get a percentage of filled out fields per user. ...

Refreshing a echoed PHP variable after jQuery AJAX success?

Hello, I have a shopping cart in Codeigniter in which products are added to the cart using (jQuery) Ajax. In the header of each page it displays the number of contents in the cart using <?php echo $this->cart->total_items(); ?> How can I update/refresh this variable when a product is added to the cart, as I am using AJAX to add prod...

Empty database output in CI

Hi. I'm building a simple app and trying to test DB result output. But unfortunately all I'm getting is an array of size 0. Here's the controller code excerpt: $data['query'] = $this->db->query('SELECT role_id, role_privilege FROM role'); $this->load->view('welcome_message', $data); And a view code excerpt: <?php echo count($...

Send 404 when requesting index.php through .htaccess?

I've recently refactored an existing CodeIgniter application to use url segments instead of query strings, and I'm using a rewriterule in htaccess to rewrite stuff to index.php: RewriteRule ^(.*)$ /index.php/$1 [L] My problem right now is that a lot of this website's pages are indexed by google with a link to index.php. Since I made t...

Codeigniter + ajax(jQuery) session problem

Hello, I have a problem in server side retrieving session with using ajax post request. Here is my sample code: JavaScript: $(function() { $('.jid_hidden_data').submit(function() { var serialized = $(this).serialize(); var sUrl = "http://localhost/stuff"; $.ajax({ url: sUrl, type: "P...

REST Authentication in PHP (CodeIgniter)

I writing REST API form my web application. Application is written using CodeIgniter framework. Application itself is working fine, but I'm stuck on making REST Authentication. I think that basic Http Authentication will be good enough for some time. Public API is not yet planned. Is there any code example how to achieve REST Authentica...

CI controller function is ignored

Hi. I'm trying to pass through a CI tutorial (writing a simple forum) and I can't make a controller function called. To be more specific I have this in a controller: function __construct() { parent::Controller(); $this->load->helper('url'); } function index() { $data['title'] = "Wlcome to Go...

please explain the dataflow in MVC specially in codeigniter

Dear friends, Can anyone please explain me the object flow in codeigniter MVC ? I can see for example when I put the followong code in controller it works, but i am not being able to figure out which part of this goes in model in vews. I tried several ways but coudn't. When i use the example codes from other it works but myself i am get...

How to get an array of all controllers in a Codeigniter project ?

I'd like to obtain a list of all controllers in a Codeiginiter project so I can easily loop through each of them and add defined routes. I can't seem to find a method that will give me what I'm after ? Here is the code snippet from the routes.php file where I would like to access the array: - // I'd like $controllers to be dynamically...

codeigniter: Where to define members in a model?

Hello, I would like to know what is the best practice to define class members in a CodeIgniter model? Thank you. ...

CI + Joomla 1.5

Hi, This is something that I just cooked up with Joomla and CodeIgniter(CI). I Wrote my database intensive application in CodeIgniter and frontend is Joomla. I'm using Jumi(Joomla Extention) so I can include the CI files inside joomla to basically insert the content generated by CI into Joomla articles. Problem is, you can't include CI...