Codeigniter Interview Question Answer
1 - Explain CodeIgniter Url Structure

Domain/class/function/querystring

For example

http://www.ittrainingonline.co.in/user/tutorial/codeigniter/81

http://www.ittrainingonline.co.in is a domain
user is a controller name
tutorial is a function name
codigniter and 81 both are querystring value

2 - How to Prevent SQL injection in Codeigniter?

There are three way to prevent SQL injection.

1- Active Record Class
$this->db->get(tablename);

2- Escaping Queries
$query = "select * from info where name=".$this->db->escape($name);
$this->db->query($query);

3- Query Binding
$sql = "select * from info WHERE id=? and name=?";
$this->db->query($sql, array('35', 'shishir sharma'));

3 - List of CodeIgniter Version

CodeIgniter 2 (legacy)

CodeIgniter 3 (current) - Recommended

CodeIgniter 4 (future)

4 - List Databases supported By Codeigniter

MySQL
Oracle
PostgreSQL
SQLite
CUBRID

5 - What is the default controller in CodeIgniter?

By default default controller is welcome, we change the default controller

Got application->config->routes.php file

we will see by default codeigniter show welcome

$route['default_controller'] = 'welcome';

here we can change our controller.

6 - What is the difference between helper and library in codeigniter?

Helper is functions, we are just inclue helper file then we can call function Models,Views and Controllers.But Library is class, we create instance of the class by $this->load->library() then we can call any function in Models,Views and Controllers.

7 - Codeigniter Feature

It is licensed under MIT so we can use free.
Light weight, all codeignier library,helper very small code so it is also fast.
Codeigniter generate SEO friendly URL.
Codeigniter follow MVC pattern, Means that spearates application logic and presentation parts.

8 - What is Helper in Codeigniter?

Helper is simply a collection of functions, these function is called procedural functions.
so for use of helper first load helper file

$this->load->helper('helpername');

In Codeigniter there are two type of helper
(a)- User define helper- we create in application->helpers
(b)- Provided by Codeigniter like Form Helper, URL Helper etc.
we can view these helper in system folder.

9 - How can we load helper in form?

$this->load->helper('form');
$this->load->helper(array('form', 'url'));

we can also load helper by application/config/autoload.php

$autoload['helpers'] = array('database', 'email', 'session');

10 - What are the hooks in CodeIgniter?

Hook file run before execution of webapplication after execution of the webapplication.

For creating hook there are three steps.

1- Enable hook in application->config->config.php file.
2- Specify code to run on application->config->hooks.php
3- Create php file in application->hook folder

11 - How many type of database supported by codeigniter frameworks?

Mysql
Oracle
PostgreSQL
SQLite


Next

Share on Facebook
Success Story
Deepak Bisht
Avatar
PHP Developer
iGATE Solution
My friends had taken Joomla training in a popular institute but I thought better not to join them. Then I found this course with It and Dc and started to study through them. I now find I am working in company in a similar role as that of friend. I am working in the parallel position with them but they say that I am more confident of my field.
Manikant kumar
Avatar
PHP Developer
Fourtek IT Solution PVT LTD
The regular knowledge at IT Training Online gave me the confidence to approach the best companies and I found the position in the corporate world I had been trying to get for a long time. The work that I do now satisfies me and gives me inspiration to perform better. I got this strength from IT Training Online when I was put under training in PHP and web development at the institute.
Sponsored Ads