Destroying a specific session in Code Igniter

Create a new column in the ci_session table. ALTER TABLE `yourdatabase`.`ci_sessions` ADD COLUMN `userid` VARCHAR(45) NULL AFTER `user_data` ; Then in your login function get the id from your login process and before adding the userdata information to the session do: /* Delete any existing sessions with the current userid session. Note – a new … Read more

subquery in codeigniter active record

->where() support passing any string to it and it will use it in the query. You can try using this: $this->db->select(‘*’)->from(‘certs’); $this->db->where(‘`id` NOT IN (SELECT `id_cer` FROM `revokace`)’, NULL, FALSE); The ,NULL,FALSE in the where() tells CodeIgniter not to escape the query, which may mess it up. UPDATE: You can also check out the subquery … Read more

Where do I put image files, css, js, etc. in Codeigniter?

I have a setup like this: application system assets js imgs css I then have a helper function that simply returns the full path to this depending on my setup, something similar to: application/helpers/utility_helper.php: function asset_url(){ return base_url().’assets/’; } I will usually keep common routines similar to this in the same file and autoload it … Read more