Questions tagged [codeigniter-2]
CodeIgniter 2.x is an old and no longer supported version of the popular PHP framework. Please refer to the [codeigniter] tag for more information.
codeigniter-2
3,139
questions
181
votes
3
answers
316k
views
Only variable references should be returned by reference - Codeigniter
After the server PHP upgrade I am getting the following error with PHP Version 5.6.2 on Apache 2.0
A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by ...
146
votes
14
answers
142k
views
Where do I put image files, css, js, etc. in Codeigniter?
Where is it acceptable to put css folders and image file folders? I was thinking inside the view folder? However the controller always reroutes the path to the base url so I have to specify the path ...
125
votes
11
answers
221k
views
CodeIgniter: How to get Controller, Action, URL information
I have these URLs:
http://backend.domain.com/system/setting/edit/12
http://backend.domain.com/product/edit/1
How to get controller name, action name from these URLs. I'm CodeIgniter newbie. Are ...
50
votes
8
answers
58k
views
How do I run CodeIgniter migrations?
I know how to create them via http://codeigniter.com/user_guide/libraries/migration.html
But once I've created my migration files, how do I run them?
48
votes
3
answers
299k
views
Codeigniter: does $this->db->last_query(); execute a query?
Does query execution happen at the get_where() clause of the following codeigniter active record statement?
$this->db->select('*');
$q = $this->db->get_where('Contacts', array('id' =&...
47
votes
16
answers
187k
views
CodeIgniter PHP Model Access "Unable to locate the model you have specified"
I have been trying to load some models for this website I am building. However, for an unknown reason, it will bring the following error :
An Error Was Encountered
Unable to locate the model you ...
35
votes
9
answers
105k
views
combining mysql AND OR queries in Codeigniter
I want to combine AND OR mysql queries in CI. I have already seen this thread: http://codeigniter.com/forums/viewthread/92818/.
But they don't provide the exact solution there.
How do I create the ...
35
votes
3
answers
48k
views
How to detect HTTP method in CodeIgniter
How can I detect HTTP method in CodeIgniter controller class?
Edited:
Is there any other way than using $_SERVER['REQUEST_METHOD'] in CodeIgniter?
33
votes
2
answers
66k
views
CodeIgniter: INSERT multiple records without cycle
It's possible to use multiple INSERT records in CodeIgniter Active Record without for, foreach and etc. ?
My current code:
foreach($tags as $tag) {
$tag = trim($tag);
$data = array(
'...
33
votes
12
answers
82k
views
CodeIgniter: "The filetype you are attempting to upload is not allowed."
I'm experiencing a very odd upload problem. Here's the relevant view file:
<form action="http://localhost/index.php/temp/upload/" method="post" enctype="multipart/form-data">
<fieldset&...
26
votes
7
answers
69k
views
How to use composer packages in codeigniter?
I've followed this article: http://philsturgeon.co.uk/blog/2012/05/composer-with-codeigniter
But I get Fatal error: Class 'Buzz\Browser' not found.
What is missing from his post?
My controller or ...
26
votes
4
answers
30k
views
Where to place global functions in codeigniter
I have created a few utility functions like one h() that acts as echo htmlentities($var) . I want theses functions to be available everywhere . so where do i put it.
24
votes
2
answers
9k
views
How is Kohana different from CodeIgniter? [closed]
I've been using CodeIgniter for a long time, however lately I've been feeling the need to move to a more advanced/more OOP framework. Kohana seems to be an often recommended option, my question is, ...
23
votes
4
answers
58k
views
How to route 2 parameters to a controller?
This seems really basic but i can't get the hang of it.
I'm trying to send more then one parameter to a method in the controller, like this :
http://localhost/ci/index.php/subjects/3/state
This is ...
21
votes
5
answers
43k
views
Extending The Controller Class in CodeIgniter
I have class MY_Controller extends CI_Controller and common logic for big profile section, so I'va tried to create class Profile extends MY_Controller with common logic for profile section and all ...
21
votes
3
answers
37k
views
Routing controllers in subfolders using CodeIgniter
since i want to separate the frontend and backend of the system. i have created 2 folders inside controllers as frontend and backend
Below is the structure of my controller folder
controller
--...
20
votes
2
answers
5k
views
Has CodeIgniter 2.0 / PHPUnit happened yet?
So i've just had a pretty disappointing morning/weekend. It came in the form of setting up PHPUnit, Integrating Eclipse etc
Now i've just discovered that there's no straightforward way to test ...
19
votes
4
answers
13k
views
CodeIgniter 2.1 issue with show_404() and 404_override
I have been working with CodeIgniter for quite a while now and I'm currently doing a project for a client that would like a custom 404 page. Everything is fine and the 404_override it works great.
My ...
18
votes
5
answers
120k
views
Using Mysql WHERE IN clause in codeigniter
I have the following mysql query. Could you please tell me how to write the same query in Codeigniter's way ?
SELECT * FROM myTable
WHERE trans_id IN ( SELECT trans_id FROM myTable WHERE ...
18
votes
4
answers
41k
views
How to show validation errors using redirect in codeigniter?
I have been dealing with a problem for a while. How can I set the validation errors using redirect in a function? This is the code I have in my controller :
function send()
{
$this->...
17
votes
2
answers
31k
views
Under Codeigniter, is it possible to see mysql_error()? [duplicate]
I have an Codeigniter app (using version 2.1.0) that is writing a transaction to a mysql database. I'm fairly sure that I've got a foreign key constraint error occurring, but I can find no way to make ...
17
votes
5
answers
19k
views
CodeIgniter Passing POST data from RestClient to RestServer API
I've spent my whole day trying to figure out this problem. Posting this issue here is my last hope. I hope someone can help to continue working on my first job.
So, POST works fine when directly ...
16
votes
4
answers
38k
views
Codeigniter - Batch Update with Multiple Where Conditions
For starters, the Codeigniter documentation on update_batch does not exist. kenjis was kind enough to provide some documentation and submit it to the repository. Hopefully they pull it soon.
Does ...
16
votes
1
answer
10k
views
PHP Error encountered when running Command Line using CodeIgniter 2.xx
I have followed the exact guide that is provided on the official codeigniter website for running the CLI (command-line interface) tool. https://www.codeigniter.com/userguide2/general/cli.html
My ...
16
votes
1
answer
7k
views
Can I pass data to the Codeigniter output class without displaying it?
I'm working on a way for users to be able to generate PDF copies of invoices and other tabular data. To do this, I've wrapped dompdf into a library that I can use with CI and created a method that ...
15
votes
5
answers
27k
views
Codeigniter echoing [::1] instead of localhost
I am using CodeIgniter 3 as a web platform and trying to import semantic-UI CSS into my page. I'm doing so by using CodeIgniter's base_url() method in the href property for the CSS import.
However, ...
14
votes
3
answers
36k
views
Reports in Codeigniter
What is the most simplist way to generate reports in Codeigniter framework? Is there any library available to do this task? Except charting what are the other resources to do this.
14
votes
6
answers
32k
views
how to pass a variable from one controller to the other in Code igniter
I have just started learning Code Igniter .
I want to know how can I pass a variable from one controller(first_cont.php) to other controller (second_cont.php) ?
Any help would be appreciated .
...
14
votes
5
answers
3k
views
CodeIgniter update query gets executed twice
I am using CodeIgniter 2.2.
I have to update database with +1 every time a page is visited. Code works but it get incremented by +2 every time.
Example: if total views=2, once the page is clicked ...
13
votes
5
answers
8k
views
Update Database Field Error CodeIgniter
I am getting the following error message in CodeIgniter 2.1:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: database/DB_active_rec.php
Line Number: ...
13
votes
4
answers
20k
views
setting cookies with HTTPOnly flags in codeigniter
I'd like to know how to set cookies as HTTPOnly in Codeigniter. I reviewed the documentation and didn't see how to set this flag.
I was also looking to set the secure flag for cookies and found it ...
13
votes
4
answers
15k
views
Processing large amounts of data in PHP without a browser timeout
I have array of mobile numbers, around 50,000. I'm trying to process and send bulk SMS to these numbers using third-party API, but the browser will freeze for some minutes. I'm looking for a better ...
13
votes
5
answers
10k
views
Heroku PHP app crash bash: vendor/bin/heroku-php-apache2: No such file or directory
I'm not very good with Heroku setup
I'm trying to put online an app in PHP (with Code Igniter) but it doesn't work well. Here is the error :
Heroku PHP app crash bash: vendor/bin/heroku-php-apache2: ...
13
votes
1
answer
19k
views
Is there a function like _compile_select or get_compiled_select()?
Looks like _compile_select is deprecated and get_compiled_select is not added to 2.1.0. Are there any other functions like those two? And also I am curious. Is there any particular reason to not ...
13
votes
8
answers
10k
views
Cannot redefine class on 'require_once'
UPDATE:
I've abandoned CodeIgniter, and the desire to build a web interface around my database application from PHP, as there was no way of getting rid of this bug...
The Exception
I get this ...
13
votes
4
answers
18k
views
Codeigniter application getting hacked, code injected in index.php
I have a codeigniter 2.0.2 project that keeps getting hacked. There are two main issues:
Malicious code is being added to the start of the index.php file
Rogue files are added to the server
...
12
votes
5
answers
37k
views
Only variables should be assigned by reference with function
I use old version of Codeigniter framework. With new version of php I am gettings this error:
Only variables should be assigned by reference
I am wondering if this is safe bugfix:
Changing:
$this-&...
11
votes
5
answers
54k
views
How to use 'DISTINCT' in Codeigniter Active Records?
I have a query using active records.
$this->db->select('reg.users_id,reg.registration_id,reg.device_type');
$this->db->join('users as usr','usr.users_id = reg.users_id','left');
$this->...
11
votes
2
answers
30k
views
Is there a difference between the method of helper and library are called upon in code igniter?
I am getting little bit confused, the way the methods of library and helper are used in code igniter. I am still learning code igniter.
CONTROLLER
function index(){
$this->load->helper('...
11
votes
1
answer
31k
views
Check number of affected rows in CodeIgniter
I am trying to check in my model method if there was affected any rows if so return true else return false, but I don't know how to get it?:
class User_model extends CI_Model {
function ...
11
votes
1
answer
3k
views
Should i develop in codeigniter now on? [closed]
Their official site says they are willing to sell this framework, just wondering what will be the future of CI, or I should simply switch framework ?
11
votes
1
answer
6k
views
update nestet set tree with php and nestable.js jquery plugin
EDIT: After great answer the @vadim-ashikhman. The end of the question.
Resources I'm using:
PHP Framework Codeigniter
Nested set Library : https://github.com/olimortimer/ci-nested-sets/
jQuery ...
10
votes
5
answers
37k
views
Codeigniter 2 on IIS with web.config file
I have a codeigniter app working fine locally with WAMP. However, I am having trouble getting it to work on an IIS server. Please note that I do not want to enable query strings.
Here is what I ...
10
votes
3
answers
5k
views
PhpStorm CodeIgniter class not found
Can you help me on this one. I'm new in CodeIgniter and PhpStorm, I'm having a problem. The PhpStorm IDE is showing an error, even though the code works fine (the Persons(controller) class can't find ...
10
votes
2
answers
4k
views
Is there any known bug in the session library of CodeIgniter 2.1.0? Why do I get kicked out? [closed]
I'm working on a website which is created with CodeIgniter 2.1.0.
I've noticed sometimes when I reload a page couple of times or open a couple of pages very fast or when I have an error in the code (...
10
votes
5
answers
12k
views
codeigniter form validation set_value works only for the fields which have rules
Suppose if I have two fields in my form viz first_name and last_name
I have set the validation rule only for first_name.
set_value should work for both the fields regardless of rule ? right ?
For ...
10
votes
1
answer
4k
views
IonAuth - seems to be randomly logging me out
I'm using ionAuth & it seems to be logging me out almost randomly? I'm using Codeigniter v2.1.4 - it logs in perfect fine however ionAuth seems to log out at random intevals, is there a way to ...
10
votes
3
answers
48k
views
click jquery button + send data without form - bookmark
I'm working on a bookmarking function where the user clicks on a jQueryui button and certain information is sent to the database. But I'm not using a form, because there is no information for the user ...
10
votes
1
answer
3k
views
How to use database codeigniter class without codeIgniter MVC framework?
My goal is to use the CodeIgniter database Class, but inside a plain PHP script.
I don't want to use MVC structure for this.
Can I use this database class WITHOUT using the CodeIgniter MVC pattern?
...
9
votes
4
answers
38k
views
Calling stored procedure in codeigniter
I am using latest codeigniter and trying to call stored procedure from my model. Also I am using mysqli as database driver. Now I am having an error when I call two stored procedures. Following is the ...