CodeIgniter Basics

Everything You Need to Get Started With CodeIgniter

Jan 26th in PHP by Ben Haines

CodeIgniter is a web application framework for PHP. It enables developers to build web applications faster, and it offers many helpful code libraries and helpers which speed up tedious tasks in PHP. CodeIgniter is based on a modular design; meaning that you can implement specific libraries at your discretion - which adds to the speed of the framework. This tutorial will attempt to show you the basics of setting up the framework, including how to build a basic hello world application that uses the MVC approach.

PG

Author: Ben Haines

Hi, I'm Ben. I'm a developer/designer from a lil' country at the bottom of the world called New Zealand. My poisons of choice are PHP and CodeIgniter, JS and Mootools, CSS, and (X)HTML

Why a Framework?

Why a Framework?

Frameworks allow for structure in developing applications by providing reusable classes and functions which can reduce development time significantly. Some downsides to frameworks are that they provide unwanted classes, adding code bloat which makes the app harder to navigate.

Why CodeIgniter?

CodeIgniter Basics

CodeIgniter is a very light, well performing framework. While, it is perfect for a beginner (because of the small learning curve), it's also perfect for large and demanding web applications. CodeIgniter is developed by EllisLab and has thorough, easy to understand documentation. Below is a list of reasons of what makes CodeIgniter a smart framework to use?

  • Small footprint with exceptional performance
  • MVC approach to development (although it is very loosely based which allows for flexibility)
  • Generates search engine friendly clean URLs
  • Easily extensible
  • Runs on both PHP 4 (4.3.2+) and 5
  • Support for most major databases including MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite, and ODBC.
  • Application security is a focus
  • Easy caching operations
  • Many libraries and helpers to help you with complex operations such as email, image manipulation, form validation, file uploading, sessions, multilingual apps and creating apis for your app
  • Most libraries are only loaded when needed which cuts back on resources needed

Why MVC?

MVC

For starters, MVC stands for Model, View, Controller. It is a programing pattern used in developing web apps. This pattern isolates the user interface and backend (i.e. database interaction from each other. A successful implementation of this lets developers modify their user interface or backend with out affecting the other. MVC also increases the flexibly of an app by being able to resuse models or views over again). Below is a description of MVC.

  • Model: The model deals with the raw data and database interaction and will contain functions like adding records to a database or selecting specific database records. In CI the model component is not required and can be included in the controller.
  • View: The view deals with displaying the data and interface controls to the user with. In CI the view could be a web page, rss feed, ajax data or any other "page".
  • Controller: The controller acts as the in between of view and model and, as the name suggests, it controls what is sent to the view from the model. In CI, the controller is also the place to load libraries and helpers.

An example of a MVC approach would be for a contact form.

  1. The user interacts with the view by filling in a form and submitting it.
  2. The controller receives the POST data from the form, the controller sends this data to the model which updates in the database.
  3. The model then sends the result of the database to the controller.
  4. This result is updated in the view and displayed to the user.

This may sound like alot of work to do. But, trust me; when you're working with a large application, being able to reuse models or views saves a great deal of time.

Step 1: Downloading CodeIgniter

Too start off you will need to download CodeIgniter and upload it to your server. Point your browser to http://www.codeigniter.com/ and click the large download button. For this tutorial we are using version 1.70.

Step 2: Installing and Exploring CodeIgniter

Once you have downloaded CodeIgniter, all you need to do is unzip it, and rename the "CodeIgniter_1.7.0" folder to either the application name or, in this case, "ci" and upload it to your PHP and MySQL enabled server. Now that its on your server, I'll explain what all the folders and files are for:

  • The system folder stores all the files which make CI work.
    • The application folder is almost identical to the contents of the system folder this is so the user can have files that are particular to that application, for example if a user only wanted to load a helper in one application he would place it in the system/application/helpers folder instead of the system/helpers folder.
      • The config folder stores all the config files relevant to the application. Which includes information on what libaries the application should auto load and database details.
      • The controllers folder stores all the controllers for the application.
      • The errors folder stores all the template error pages for the application. When an error occurs the error page is generated from one of these templates.
      • The helpers folder stores all the helpers which are specific to your application.
      • The hooks folder is for hooks which modify the functioning of CI's core files, hooks should only be used by advanced users of CI
      • The language folder stores lines of text which can be loaded through the language library to create multilingual sites.
      • The libraries folder stores all the libraries which are specific to your application.
      • The models folder stores all the models for the application.
      • The views folder stores all the views for the application.
    • The cache folder stores all the caches generated by the caching library.
    • The codeigniter folder stores all the internals which make CI work.
    • The database folder stores all the database drivers and class which enable you to connect to database.
    • The fonts folder stores all the fonts which can be used by the image manipulation library.
    • The helpers folder stores all of CI's core helpers but you can place your own helpers in here which can be accessed by all of your applications.
    • The language folder stores all of CI's core language files which its libaries and helpers use. You can also put your own language folders which can accessed by all of your applications.
    • The libaries folder stores all of CI's core libaries but you can place your own libraries in here which can be accessed by all of your applications
    • The logs folder stores all of the logs generated by CI.
    • The plugin folder stores all of the plugins which you can use. Plugins are almost identical to helpers, plugins are functions intended to be shared by the community.
    • The scaffolding folder stores all the files which make the scaffolding class work. Scaffolding provides a convenient CRUD like interface to access information in your database during development.
  • The user_guide houses the user guide to CI.
  • The index.php file is the bit that does all the CI magic it also lets the you change the name of the system and application folders.

Step 3: Configuring CodeIgniter

Getting CI up and running is rather simple. Most of it requires you to edit a few configuration files.

You need to setup CI to point to the right base URL of the app. To do this, open up system/application/config/config.php and edit the base_url array item to point to your server and CI folder.

$config['base_url'] = "http://localhost/ci/";

Step 4: Testing CodeIgniter

We'll do a quick test to see if CI is up and running properly. Go to http://localhost/ci/ and you should see the following.

Step 5: Configuring CodeIgniter Cont.

If you're up and running, we should finish the configuration. We are starting to configure it specifically for our new helloworld app. If you want to use a database with your application, (which in this tutorial we do.) open up system/application/config/database.php and set the following array items to there corresponding values. This code connects to a MySQL database called "helloworld" on a localhost with the username "root", and the password, "root".

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "root";
$db['default']['database'] = "helloworld";
$db['default']['dbdriver'] = "mysql";

Additionally, since we will be using the database quite a bit, we want it to auto load so that we don't have to specifically load it each time we connect. Open the system/application/config/autoload.php file and add 'database' to the autoload libaries array.

$autoload['libraries'] = array('database');

Currently, the CI setup will have a default controller called "welcome.php"; you can find this in the system/application/controllers folder. For this tutorial, delete it and open your system/application/config/routes.php file. Change the default array item to point to the "helloworld" controller.

 $route['default_controller'] = "Helloworld"

CI also has a view file that we do not need. Open up the system/application/view/ folder and delete the welcome_message.php file.

Step 6: Create the Helloworld Database

As this isn't really a tutorial on MySQL, I'll keep this section as short as possible. Create a database called "helloworld" and run the following SQL through phpMyAdmin (or similar MySQL client).

CREATE TABLE `data` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `text` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

INSERT INTO `data` (`id`, `title`, `text`) VALUES(1, 'Hello World!', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla 
sapien eros, lacinia eu, consectetur vel, dignissim et, massa. Praesent suscipit nunc vitae neque. Duis a ipsum. Nunc a erat. Praesent 
nec libero. Phasellus lobortis, velit sed pharetra imperdiet, justo ipsum facilisis arcu, in eleifend elit nulla sit amet tellus. 
Pellentesque molestie dui lacinia nulla. Sed vitae arcu at nisl sodales ultricies. Etiam mi ligula, consequat eget, elementum sed, 
vulputate in, augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;');

Step 7: Create the Helloworld Model

Models are optional in CI, but it's considered best practice to use them. They are just PHP classes that contain functions which work with information from the database. Go ahead and make a helloworld_model.php file in the system/application/models folder. In this file, create a Helloworld_model class, Helloworld_model construct and a function called getData.

In the getData function we are going to use Active Record database functions which speed up database development times when working with CI and databases. Essentially, they are simplified functions to create queries.

<?php
class Helloworld_model extends Model {

    function Helloworld_model()
    {
        // Call the Model constructor
        parent::Model();
    }
    
    function getData()
		{
			//Query the data table for every record and row
			$query = $this->db->get('data');
			
			if ($query->num_rows() > 0)
			{
				//show_error('Database is empty!');
			}else{
				return $query->result();
			}
		}

}
?>

Step 8: Create the Helloworld Controller

Let's create a controller that will display the view, and load the model. That way, when you go to the address http://localhost/ci/index.php/helloworld/, you will see the data from the database. In the folder system/application/controllers, create a file called helloworld.php. In this new file, we'll create a class which has the same name as the file.

Within this class, you need to create a function called "index". This is the function that will be displayed when no other is provided - e.g. when http://localhost/ci/index.php/helloworld/ is visited. If, for example, we created a function called foo, we could find this as http://localhost/ci/index.php/helloworld/foo/.

The key thing to remember is how CI structures its URLs; e.g http://host/codeignitordirectory/index.php/class/function.

In the controller index function, we need to load the model, query the database, and pass this queried data to the view. To load any resources into CI e.g. libraries, helpers, views, or, models, we use the load class. After we have loaded the model, we can access it through its model name and the particular function. To pass data to a view we need to assign it to an array item and pass the array - which recreates the array items as a variable in the view file.

<?php
	class Helloworld extends Controller{
		function index()
		{
			$this->load->model('helloworld_model');

			$data['result'] = $this->helloworld_model->getData();
			$data['page_title'] = "CI Hello World App!";

			$this->load->view('helloworld_view',$data);
	    }
	}
?>

If we visited http://localhost/ci/index.php/helloworld/ now, it wouldn't work; this is because the view file does not exist.

Step 9: Create the Helloworld View

The view file is what the user sees and interacts with, it could be a segment of a page, or the whole page. You can pass an array of variables to the view through the second argument of the load model function. To make the view for our tutorial, create a new file called helloworld_view.php in the system/application/view folder. Next, we just need to create our normal html, head and body elements, and then a header and paragraph for the information from the database. To display all the records received from the database, we put it in a "foreach" loop which loops through all the elements.

<html>
	<head>
		<title><?=$page_title?></title>
	</head>
	<body>
		<?php foreach($result as $row):?>
		<h3><?=$row->title?></h3>
		<p><?=$row->text?></p>
		<br />
		<?php endforeach;?>
	</body>
</html>

You may have noticed that we are using php alternative syntax, this provides an convenient and time saving way to write echo statements.

Step 10: Ta-da and Some Extras

When you visit "http://localhost/ci/index.php/helloworld/", you should see something similar to this.

But we aren't done yet. There are a few things you can do to improve your CodeIgniter experience - like removing that annoying index.php bit out of the URL. You can accomplish this task by creating a .htaccess file in the root folder, and adding the following code.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ ci/index.php/$1 [L]
        

You'll also need to open up the config.php file in system/application/config/ and edit the index_page array item to a blank string.

$config['index_page'] = ""; 

Another nifty trick is to turn on CI's ability to parse PHP alternative syntax if its not enabled by the server. To do this, open up the same file as before, system/application/config/config.php, and set the rewrite_short_tags array item to TRUE.

$config['rewrite_short_tags'] = TRUE;

I hope all goes well! Look forward to seeing more CodeIgniter tutorials from me in the future.

  • Subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.


Related Posts

Check out some more great tutorials and articles that you might like

Enjoy this Post?

Your vote will help us grow this site and provide even more awesomeness

Plus Members

Source Files, Bonus Tutorials and
More for $9 a month for all TUTS+
sites in one subscription.

Join Now

User Comments

( ADD YOURS )
  1. PG

    Brenelz January 26th

    Wow… I had played with CodeIgner a bit previously, but this really helped explain some things I wasn’t sure about.

    Personally I find CodeIgniter more friendly than CakePHP or Symfony. No need to use the command line. I know you die hards will probably say CakePHP has more capabilities, but I find it too bloated. Just my opinion, haven’t used it overly much.

    ( Reply )
  2. PG

    Tommy M. January 26th

    I have been waiting for a great Codeignitor tutorial for the past 2 months! I am very excited to read this.

    ( Reply )
  3. PG

    Francisco Costa January 26th

    I like CakePHP and Symfony

    ( Reply )
  4. PG

    Mike January 26th

    Thank you god! I have been waiting to get into CodeIgniter. I’m really looking to use codeigniter on a few upcoming projects that are gonna rely more on the speed of this framework than anything

    ( Reply )
  5. PG

    Hasanga January 26th

    Ci is a very powerful framework.
    Good to see some stuff here at net tuts!

    Keep em coming guys!

    ( Reply )
  6. PG

    DKumar M. January 26th

    I prefer CodeIgniter as it’s more user-friendly the other available options. I also prefer CakePHP !!

    ( Reply )
  7. PG

    chris simpson January 26th

    Great article… CI is a framework i havnt yet tried out. ill definatly give it ago sometime..

    It seems very logical, but i suppose thats because once you see one MVC framework youve seen them all (*i know this isnt strictly true, and that different frameworks do indeed have individual pro’s and con’s but you get what i mean)

    The annoying thing about frameworks are that everytime you mention a name of a framework all the ‘purists’ get on their soap box about writing your own classes and not relying on frameworks and that frameworks are always clunky etc… but also then the framework fanboys come along and ramble about the ease and productivity increases…

    Anyway. Great article, any plans to turn this into a series?

    ( Reply )
  8. PG

    Brenelz January 26th

    How well does CodeIgniter work on IIS as I know it relies on Mod_Rewrite for its urls.

    I guess you would have to use query strings….?

    ( Reply )
  9. PG

    barat January 26th

    Well … I’m thinking about a framework to make my work faster. There was CI on my list, but I think that I’ll choise Kohana.
    But hey – this tutorial will help – Kohana is CI based but IMO it’s better, easier … it doesn’t demand that You have to use Models, Views and Controllers even if You don’t need them :)

    ( Reply )
  10. PG

    Neil January 26th

    Great article! I love CodeIgniter – good to see a nice introduction written up here..

    FYI – I think you’ve got a typo in Step 8 in the getData() method – I believe it should be:
    if ($query->num_rows() == 0)

    ( Reply )
    1. PG

      zashi June 21st

      Why o god didn’t I look at comments? I spent 6 hours looking for that tiny little error… I actually thought that database connection only works in views…
      Ben please modify the tutorial somehow.

      ( Reply )
      1. PG

        Mike June 22nd

        Actually for that If statement that he has written it will work, but I believe he meant it to be # if ($query->num_rows() result();
        # }

  11. PG

    neuromancer January 26th

    I’m currently looking around at a few frameworks to see which one would be good for a ‘framework virgin’ like me to dive into.CI certainly looks the easiest to understand. The only big requirement I have is the ability to use the full google maps API. I’m guessing that I could just create a set of custom PHP wrapper classes to do all that but the issue is getting it all to work within the framework’s MVC structure….any suggestions?

    ( Reply )
    1. PG

      Sebastian June 22nd

      Your gravatar looks like someone is getting ***** on a picnic table…

      ( Reply )
  12. PG

    Nick D January 26th

    Great beginning Ci article. I’m building a web application in it right now and have been trying to think of the best way to overcome a problem I’m having.

    I have the system folder outside of my public root directory, and now all my views have to reference template files, such as CSS and images, that are inside the public root folder. It’s making for a lot of clutter, and I’m having a hard time keeping track of all the files.

    Should I just get move the system folder back to the public root?

    ( Reply )
  13. PG

    Nick Brewer January 26th

    I recently started using Ci for a project, it was much easier to pick up than CakePHP and some of the other frameworks. I am glad to see a tutorial for Ci on Nettuts.

    ( Reply )
  14. PG

    M.A.Yoosuf January 26th

    Ha ha, Expression engine also coming in to NETTUTS, All most all the things are NETTUTS,

    Code integer is Just a beginning of Expression Engine, i guess :)

    ( Reply )
  15. PG

    Joe January 26th

    To anybody just starting to explore CI, be sure to check out some of the excellent getting started screencasts http://codeigniter.com/tutorials/ . Last summer I started with CI and after first watching the 20 minute blog, then again mirroring what he did, I hit the ground running. Their documentation is excellent and forums are helpful. For a pure php5 version of CI, take a look at Kohana (kohanaphp.com), which was originally a CI fork.

    ( Reply )
  16. PG

    Nick January 26th

    Hey Ben thanks for introducing me to something new!

    I’ve been wondering.. maybe you can help me, say I have a link http://www.site.com/sitefolder/index.php how can I edit the htaccess to show it just as http://www.site.com/sitefolder

    I saw you did it with localhost but I thought I would ask about this way in case it is done differently.

    Thanks again!

    -Nick

    ( Reply )
    1. PG

      MorayWeb April 10th

      It’s covered in the user guide, you’ll find what your after here http://codeigniter.com/user_guide/general/urls.html

      Hope it helps…

      Gordon

      ( Reply )
  17. PG

    Shane January 26th

    Nice to see a CodeIgniter tutorial on here. It’s definitely worth looking at if you haven’t already.

    ( Reply )
  18. PG

    Joe T P January 26th

    I don’t understand step 2 and step 10.. can someone help?

    ( Reply )
  19. PG

    Dizzledorf January 26th

    Has anyone actually tried this code?

    In /controllers/helloworld.php there is an error:
    // not: $data['result'] = $this->helloworld_model->getData();
    // should (?) be:
    $data['result'] = $this->helloworld_model->getData();

    Even then, I still get a PHP error:
    Message: Invalid argument supplied for foreach()
    Filename: views/helloworld_view.php
    Line Number: 8

    Also, where’s Step 2?

    – DIZZLE

    ( Reply )
    1. PG

      shane March 20th

      got the same error

      ( Reply )
    2. PG

      Noc May 7th

      Same:
      A PHP Error was encountered

      Severity: Warning

      Message: Invalid argument supplied for foreach()

      Filename: views/helloworld_view.php

      Line Number: 6

      ( Reply )
      1. PG

        Leo Rapirap May 19th

        open helloworld_model.php

        function getData()

        line : if ($query->num_rows() > 0)
        should be: if ($query->num_rows() == 0)

  20. PG

    demogar January 26th

    I’m a big fan of CodeIgniter and I’ve been using it for a while.

    I tried before CakePHP and Zend Framework and I prefer CodeIgniter because it’s flexibility.

    CodeIgniter has a small learning curve (you can learn it in one day), it lets you do whatever you wanna do and it really has the best performance in PHP frameworks, the documentation is awsome and I quote what Rasmus Lerdorf (PHP creator) @ frOSCon in August 2008 said: “I prefer CodeIgniter because it is faster, lighter and the least like a framework”.

    Good article (as usual)

    ( Reply )
  21. PG

    Dizzledorf January 26th

    Ha, of course the tags were stripped…

    In Step 9, you need to remove the SPAN tags around the getData() call.

    ( Reply )
  22. PG

    Dan Harper January 26th

    Nice article :) Personally I love CodeIgniter!

    BTW, since you’re using <?= as short-code for an echo, you may as well use <? as shorthand for <?php

    But using shorthand is not really recommended if you do not know the info of the server you are publishing on, as some have support for PHP shorthand disabled.
    See here: http://codeigniter.com/user_guide/general/alternative_php.html

    ( Reply )
  23. PG

    Wassim January 26th

    @barat – (and potentially every one here in the discussion) – I think web developers/designers must take a deeper look at Drupal. Drupal is an amazing CMS (it weighs 1mb compared to a very less fonctional Wordpress which weighs 1.2mb) and most people ignore the fact that Drupal is a real web application framework that has MVC paradigms, RDF paradigms and all the semantic web ones. Why reinventing the wheel, the API Drupal provides is a piece of art and challenges whatever MVC framework you consider.
    I know people here at Envato are definitely Wordpress people, but I can’t miss this opportunity to talk about Drupal as a framework.
    Anyways, really good post Ben :-)

    ( Reply )
  24. PG

    Dan Harper January 26th

    Also, I should mention that the best part about CodeIgniter is that it has a VERY helpful and full user-guide at http://codeigniter.com/user_guide/ – this is something it seems the other frameworks definitely need to catch up on!

    ( Reply )
  25. PG

    Adam Griffiths January 26th

    Some great points made here. I have been a CI developer for about a year now, am active on the CI forums and am author of the Fresh Powered libraries, all I can say is, CI is a brilliant framework.

    Also, instead of using a PHP closing tag, you should use comments.

    /* End of file: file.php */
    /* Location: system/application/controllers/file.php */

    This is mentioned in the CI style guide. (Sorry, not a clue how to add links!!)

    @barat: Kohana is a fork of CI, so the people behind it took the CI code and took it in their own direction. So, CI and Kohana are variable. You don’t need to use models and don’t even need to use views either. It’s just best practice to use these as it makes applications more manageable.

    ( Reply )
  26. PG

    The Font Squirrel January 26th

    You may have seen the site I recently built http://www.fontsquirrel.com. This was written entirely in CodeIgnitor. Great framework, and enough cannot be said for having clear, thorough documentation. This factor alone makes the framework IMO. There are some video tutorials which help you get your mind around the CI paradigm too. Good stuff!

    ( Reply )
  27. PG

    Ivan January 26th

    I’m personally a huge CakePHP fan mostly because I’m lazy and it does very much with very little effort.

    But this is a really great article and I just might give CI a go next weekend.

    @demogar: Rasmus may be the guy who “invented” PHP, but he’s a dinosaur. Don’t trust everything you hear ;-) Saying CI is least of a framework isn’t a compliment.

    Hope this article gets a “part 2″ soon.

    ( Reply )
  28. PG

    Ivan January 26th

    @Joe:

    Step 2: Get some coffee

    Step 10: Lunch break :-)

    ( Reply )
  29. PG

    Kevin Quillen January 26th

    “I think web developers/designers must take a deeper look at Drupal.”

    We’re already there, but most people here will live and die by Wordpress for some reason.

    ( Reply )
  30. PG

    Dan Harper January 26th

    Drupal and Joomla both need more extensive Documentation IMO – much like CI and WordPress have done.

    ( Reply )
  31. PG

    iEthan January 26th

    Great tut! But I can’t help but notice that is goes from step 1 to 3.

    ( Reply )
  32. PG

    Ben Haines January 26th

    @barat: Personally I think CI whips Kohanas butt in terms of like ease of use, portability and speed. CI seems much more thoroughly tested and implemented. But I mean each to their own use whatever framework that works for you!

    @Nick: Yes it will work the same!

    Ahhh and im not sure what happened to step 2 or 10, it could be my bad.

    Also i have no idea why there are span tags in the code in step 9?

    ( Reply )
  33. PG

    Rob January 26th

    What is the root folder for the .htaccess. CI folder, application….

    ( Reply )
  34. PG

    Patternhead January 26th

    I’ve been looking at Cakephp, Code Igniter and Yii for a future app. Thanks for the info on Code Igniter.

    I’d love to see an up to date comparison of “the top” php frameworks.

    ( Reply )
  35. PG

    Jash Sayani January 26th

    I really want to learn PHP !! I just know some basics needed to troubleshoot WP issues…

    Can anyone suggest learning website/screencasts/E-book ??

    Thanks.

    ( Reply )
  36. PG

    jen January 26th

    Thanks for this!

    Do you know if there are any good ruby frameworks?

    ( Reply )
  37. PG

    Shaun January 26th

    @M.A.Yoosuf

    CodeIgniter is what ExpressionEngine is built on.

    ( Reply )
  38. PG

    Wassim January 26th

    @Jash Sayani – I recommend “Zend PHP 5 Certification Study Guide” by Davey Shafik. Its intended for people preparing the Zend Certification Exam but it’s a great book to learn PHP.

    ( Reply )
  39. PG

    neuromancer January 26th

    @Wassim,@Jash Sayani – I found the Zend study guide a bit too heavy on syntax etc as it is a certification guide at the end of the day. I actually found the wrox press beginning PHP5 book much easier to start out with, even if it is a rather hefty 1200 pages!!!! A bit wierd but hey, whatever wo

    ( Reply )
  40. PG

    Chad January 26th

    I am just trying to get started with PHP (MS developer for over 10 years) and I really enjoyed the CodeIngniter tutorial!

    ( Reply )
  41. PG

    Dan Harper January 26th

    @Jash Sayani – Jeffrey (NETTUTS & ThemeForest Manager) is running a PHP screencast series on the ThemeForest Blog (see here: http://nettuts.com/videos/screencasts/new-wp-video-series-and-free-rockstar-book/ )

    ( Reply )
  42. PG

    Alex January 26th

    Hey, guys. How about the Zend Framework?
    I don’t see anybody talking about it in the quick view I gave at the comments. Isn’t it a good one?

    What do you think of Code Igniter when compared to Zend’s Framework?

    I’m currently reading Zend’s PHP 101: PHP For the Absolute Beginner tutorial. Since it’s a good a tutorial and I’m actually learning some things, I was considering to take a look at their framework too.

    ( Reply )
  43. PG

    Ben Haines January 26th

    Guys Expression Engine 2.0 has the same architecture and will utilize the same libraries as CI but its not strictly built on CI.

    ( Reply )
  44. PG

    Nokadota January 26th

    Um, yeah. If Font Squirrel was written in this, I think I need to learn it. Awesomeness. Thanks a lot for the tutorial!

    ( Reply )
  45. PG

    Nate January 26th

    No step 2, yet two step 11s? Then where’s 10? LOL, forget to count? :P

    ( Reply )
  46. PG

    Swapnil Sarwe January 26th

    Its been almost a month I am working on CodeIgniter but most of the stuff was built my my other team members, and only the reference of there modules were more than enough for me to get started. But to start on my own and understand a bit more of CI. I think this tutorial is a good start. Thanx.

    ( Reply )
  47. PG

    TonyG January 26th

    For some reason I got this error when I tried to view Helloworld:

    Parse error: parse error in C:\www\CodeIgniter\system\libraries\Loader.php(673) : eval()’d code on line 10

    Any ideas, there is obviously something wrong with my helloworld_view.php page, I just can’t figure it out.

    ( Reply )
    1. PG

      Paul Villacorta October 21st

      Hi Tony!

      Check your php setting if the “short open tag” is enabled.
      even if you set your $config['rewrite_short_tags'] = TRUE;
      you’ll get the same error.

      ( Reply )
  48. PG

    webz January 26th

    I really like to learn CI and now i’m starting to learn it hopefully you can give advance tutorials for this thanks..

    ( Reply )
  49. PG

    Nate January 26th

    Nice tutorial.

    I just wanted to point out some errors that I came across and fixed…so anyone else that is having the problem can get thru this :)

    First, Step 8 – Line 15
    if ($query->num_rows() > 0)

    should be LESS than, not greater than:
    if ($query->num_rows() < 0)

    Second, Step 8 – Line 17
    //show_error(’Database is empty!’);

    Shouldn’t be commented out..
    show_error(’Database is empty!’);

    This is what made me realize the “<” was in the wrong direction. It threw the error i told it to, but I knew my database was not empty :)

    ( Reply )
  50. PG

    Nate January 26th

    Also, Dizzledorf is correct.

    Step 9 – Line 7 should look like:
    $data['result'] = $this->helloworld_model->getData();

    The span tags apparently aren’t rendering properly here.

    ( Reply )
    1. PG

      Shontae June 11th

      I still get this error even though I changed it from
      if ($query->num_rows() > 0)

      to

      if ($query->num_rows() == 0)

      ( Reply )
  51. PG

    insic January 26th

    Nice start for of CI tutorial. This framework is awesome. I already develop countless application using it. :)

    ( Reply )
  52. PG

    Eneza January 26th

    It depends really to your preference which framework is the best for you.

    I will try this CI myself…..

    ( Reply )
  53. PG

    test January 26th

    Sounds Good….

    ( Reply )
  54. PG

    test January 26th

    Sounds good, great he bhaya

    ( Reply )
  55. PG

    Sajmi January 26th

    Codeigniter is the best one, maybe Nette (http://nettephp.com/en/) is better … :-)

    ( Reply )
  56. PG

    Isaac Gonzalez January 26th

    One of my college professors sold me on the idea of using MVC with PHP.

    At first I was using my own custom set of libraries and then switch over to the Zend Framework. ZF is great but the library is cumbersome.

    After watching Rasmus Lerdorf “Simple is Hard” lecture I immediately switched over to CI. CI ROCKS!!! Plus I think it’s works better for shared hosting accounts.

    ( Reply )
  57. PG

    Joe January 27th

    Created few big projects in CodeIgniter. In compare of CakePHP and Symphony .. CI speed is incredible. Its very easy to understand and development process is fast and no need of command line. It also has outstanding documentation with excellent examples.
    Our main site has more than 150.000 uniques/day and runs smootly.

    ( Reply )
  58. PG

    BlogInstall January 27th

    Sorry to break the party, but CodeIgniter frameword is maintained by a commecial company named that is not quick in updating the core, bugs and improvments. I strongly suggest that if you like the concept of CI you use kohanaphp.com which is a open community driver fork of CI… much better that CI too.

    ( Reply )
  59. PG

    BlogInstall January 27th

    Sorry to break the party, but CodeIgniter framework is maintained by a commercial company named expressionengine that is not quick in updating the core, bugs and improvements. I strongly suggest that if you like the concept of CI you use kohanaphp.com which is a open community driver fork of CI… much better that CI too.

    ( Reply )
  60. PG

    Ohoboho January 27th

    Great, great, Great!

    Thank you very much!

    ( Reply )
  61. PG

    Gbaster January 27th

    i prefer qcodo style, and qcube. not Ci or Akelos or PhpFuse which is ruby on rails style.

    ( Reply )
  62. PG

    Darren McPherson January 27th

    I use code igniter, it is the shizzle if I do say so myself. There are some limitations, but you can change it to suit.

    ( Reply )
  63. PG

    Ben Haines January 27th

    @BlogInstall: Don’t really want an argument, but yes CodeIgniter is a commercial product but sometimes commercial products are better!!!! Each to there own as I said.

    And yes guys I’m currently working on my 2nd tutorial hopefully with a lot less errors!

    ( Reply )
  64. PG

    jose January 27th

    Those URLs really look ugly

    ( Reply )
  65. PG

    d13design January 27th

    Hmmm, I use CakePHP but this tutorial has got thinking about giving Ci a try.

    The CakeBake app that ships with CakePHP is a huge bonus though — scaffold an entire app in less than a minute!

    ( Reply )
  66. PG

    Cory January 27th

    Awesome to see CI getting some good exposure… I use it and I love it!

    ( Reply )
  67. PG

    jerichvc January 27th

    perfect timing.
    I cant workout mod rewrite on my xampp to trim index.php on it. Its weird, I might reinstall.

    ( Reply )
  68. PG

    John January 27th

    Great introduction, thanks!

    But some time in the future I want to see a comparison of the different frameworks, by different languages of course. It’s hard for a newbie to really find the pros with all these frameworks. Everyone of them has their own group of fanboys, and on the surface both CI and CakePHP seem quite the same :( . A summary of pros and cons would be nice. I don’t say you have to pick one and stick with that forever, but nowadays I don’t have all the time in the world to learn a framework :)

    ( Reply )
  69. PG

    Shaun January 27th

    @Alex
    CI is much faster than Zend, easier to learn, yada yada.
    Zend is extremely slow, but good for enterprise applications.

    I like CI’s docs much better as well.

    @BlogInstall
    CI has been out for a long time, whereas Kohana hasn’t.
    This means CI has a larger, and IMO more helpful, community and not many bugs. On the other hand, Kohana is still going through its development stage. I don’t like how Kohana is throwing releases out that are not backwards compatible.

    If you are developing small applications that you aren’t worried about upgrading, then go for Kohana. I do love the framework and it has great potential. If you need a stable framework that you can rely on in the future, go with CodeIgniter.

    ( Reply )
  70. PG

    demogar January 27th

    @ Ivan
    Maybe Rasmus is a dinosaur, but I guess he knows better the programming language than you and me (or that’s what I think).

    About saying that one of CI’s compliments is it’s the least like a framework there’s a logical statement around that (1) you never forget you are at PHP – when you have a try at ZF must happen, (2) the learning curve is ridiculous – it’s like a bunch of classes you just include and use, (3) the response time is faster than Cake, ZF, Symfony or so – at least for me, (4) it’s REALLY flexible – you can do everything you like {call the db tables as you like, extend it with any framework, call a model from your view – not recommended but you can}, (5) etc.. – my English isn’t the best as you see, so I don’t know how to express the other ideas).
    I think the most important thing in the statement that is the least like a framework is that you can do whatever you want to do in CI, they just give the “best practice guide”.

    Read the complete Rasmus Lerdorf thing here:
    http://www.sitepoint.com/blogs/2008/08/29/rasmus-lerdorf-php-frameworks-think-again/

    ( Reply )
  71. PG

    jon January 27th

    So CodeIgniter is perfect for the beginner? Okay. The beginner what?

    What should someone who only has experience with html and css glean from this tutorial, or for that matter, from the screencasts on the CodeIgniter website?

    What beginner experience does this tutorial presume?

    ( Reply )
    1. PG

      john June 17th

      You need to learn basic PHP … You need to learn programming first. HTML, and CSS are layout languages, so I would recommend a PHP Solutions: Dynamic Web Design Made Easy to start. then come back to CI, and this tutorial.

      ( Reply )
  72. PG

    TFDM January 28th

    Currently using CI to rebuild our intranet at work. Its brilliant for legacy databases as you don’t have to rename you tables etc. For me thats a big bonus of CI. Also used it on my personal site.

    ( Reply )
  73. PG

    Saurabh Shah January 28th

    nice article… Code Igniter rocks. ..!!! i have already made applications n sites using it….

    ( Reply )
  74. PG

    Isaac Gonzalez January 28th

    @jon
    If you’ve used PHP on a few sites and have some experience connecting to a database then your ready for CI. I might even say that knowing a little OOP is another prerequisite.

    However if your still learning about variables, arrays, functions, and the SPL then your probably not ready for CI just yet.

    ( Reply )
  75. PG

    Mike January 29th

    @demogar

    That article by Rasmus has been summarily dismissed by anyone who knows anything about Rasmus or PHP. Rasmus doesn’t think PHP is meant for large-scale operations like Wordpress, Wikipedia, or Yahoo. All of his assumptions, benchmarks, and feelings are going from a Hello World app which is 10x simpler than this tutorial here. It’s really unprofessional to make the kind of comments he made without even trying each framework in a semi-real environment with semi-real conditions. As someone else mentioned Rasmus has very odd opinions about his own language and most have learned to talk his words with a grain of salt.

    CakePHP is as flexible as it needs to be. The reason some people claim it’s not is because they are trying to do things outside the MVC methodology. Like you said ‘Calling a model from a view in CI is really easy’ would make anyone with any decent knowledge and understanding of MVC cry for mercy.

    Cake is the slowest of the ‘big php frameworks’ because it does the most for you in terms of database management. But this can easily be side-stepped if needed. The fact that it crawls your entire database, learns the associations, and has the ability to return all kinds of related data based on a single query is absolutely invaluable once you get a sense of when and how to use it to your advantage.

    I’m not downing CI at all. The second version of Expression Engine is being written in CI (as I understand it), which is a huge proponent to it’s usage. It may be a good introduction to MVC but you may run into trouble when you start trying to use a true(er) MVC framework like Zend, Cake, or possibly Symfony.

    My 2 cents, don’t take everything for face value.

    ( Reply )
  76. PG

    Sean Nieuwoudt January 29th

    If you enjoy codeigniter, try KohanaPHP…

    ( Reply )
  77. PG

    jhongaby_21 January 29th

    Help us on our projet website tnx….. ^_^

    ( Reply )
  78. PG

    Steve January 29th

    Seems like everything I try, I get the “can’t connect to database” error, even though the database details are 100% correct.

    Anyway, looks really good. Nice tut.

    ( Reply )
  79. PG

    Shaun January 29th

    Kohana is nice, but be wary if you plan on using it for non-personal applications. It’s codebase is still under major development and in the past, upgrading has required changing your applications.

    ( Reply )
  80. PG

    Drazen January 30th

    # function getData()
    # {
    # //Query the data table for every record and row
    # $query = $this->db->get(’data’);
    #
    # if ($query->num_rows() > 0)
    # {
    # //show_error(’Database is empty!’);
    # }else{
    # return $query->result();
    # }
    # }

    This is wrong. It should be

    # function getData()
    # {
    # //Query the data table for every record and row
    # $query = $this->db->get(’data’);
    #
    # if ($query->num_rows() > 0)
    # {
    return $query->result();
    #
    # }else{
    # //show_error(’Database is empty!’);
    # }
    # }

    ( Reply )
  81. PG

    Eric Cheung January 30th

    CodeIgniter is a great framework. I have been reading and trying other frameworks out there and decided to use CodeIgniter in the end. Reason? Great community, Great documentation, Great File Structure and way more logical than other framework, fundamentally, Great Performance.

    Recently I helped to launch a competition campaign for Kildare Village (Outlet Village in Ireland) and the whole site is powered by CodeIgniter. http://www.simple.kildarevillage.com (Please excuse the amount of green used in there, I know it wasn’t as attractive at all, but again i wasn’t the one who designed it.) :)

    ( Reply )
  82. PG

    Bogdan February 2nd

    I have used CakePHP, Symphony, and CodeIgniter for me CI is the BEST! Their documentation on getting started is superb and then the steep learning curve starts. It is the framework I use for everything once it is setup you an just code.

    ( Reply )
  83. PG

    Eddie Cheng February 4th

    Hi i’m eddie from Singapore. Code Igniter is a wonderful framework and I’m using it for all my upcoming web projects .

    ( Reply )
  84. PG

    josheat February 5th

    Seems this has a lot of good feedback.. I’ll have to check it out
    =D

    ( Reply )
  85. PG

    Sean February 6th

    I <3 CI

    ( Reply )
  86. PG

    Tom February 8th

    Your step 7 have an error … you wrote “if there is at least 1 result, print error, else: print information”… it should be “if rows > 0: print, else: show error”…

    Anyway, prefer Cake.

    ( Reply )
  87. PG

    rachid February 9th

    i think that CI is more friendly than Cackephp;
    I love it ! tnx

    ( Reply )
  88. PG

    kooboora February 10th

    Great Tutorial !
    I’m starting with CI !
    Can’t wait for my first application…

    ( Reply )
  89. PG

    Jeff February 13th

    For the new to php/CI, in order for this tutorial to work correctly, you need to make sure Short tags are enabled on your server…and if they aren’t, you CI comes with an override in the config file. Set it to:

    ($config['rewrite_short_tags'] = TRUE;)

    …otherwise just modify the view file to use an ‘echo’

    ( Reply )
  90. PG

    hotcouponz February 15th

    I have been using the CodeIgniter for the 3 months, it is great. I loved your tutorial, very helpful.
    Thank you

    ( Reply )
  91. PG

    Shaunster February 15th

    I’ve used both CI and CakePHP. I do most of my development with CI now because it felt faster out of the box since you only load the code libraries you need. I also like CI because the code is composed of standard PHP classes that could for the most part be used on their own in non-framework code.

    ( Reply )
  92. PG

    Chris Paraiso February 19th

    Being new to frameworks myself, I’ve tried CI. Much simpler than CakePHP when starting on a framework. I’ve also read that CI could be a stepping stone into frameworks since its simple to setup and there are no strict rules as far as the way you name your models, where CakePHP would be the second step.

    By no means am I saying CI can’t do everything that Cake can. It’s just my experience (as little as it may be) thus far has shown me CI to be simpler.

    ( Reply )
  93. PG

    Naif Amoodi February 22nd

    Great stuff Ben! This tutorial has given me a kick start. I tried reading other CI tutorials but none were so helpful as this one. I hope you write more tutorials like these which will give programmers a strong understanding/base

    A quick question regarding conventions. What kind of convention does CI follow? For example if I have a controller that takes care of ‘cateogories’, should I name that controller Categories or Category (plural vs. singular)?

    ( Reply )
  94. PG

    Alecu March 3rd

    Nice tutorial, thank you, it was my first time that i installed codeigniter.

    Looking through the code in your tutorial,in helloworld controller line no. 7 looks suspicious:

    $this->helloworld_model->getData();

    Are you sure about the getData();?

    ——-

    And in the model:

    # if ($query->num_rows() > 0)
    # {
    # //show_error(’Database is empty!’);
    # }else{
    # return $query->result();
    # }

    should be:

    # if ($query->num_rows() > 0)
    # {
    # return $query->result();
    # }else{
    # //show_error(’Database is empty!’);
    # }

    Other than that, it-s a good tutorial,

    Thanks.
    Alecu

    ( Reply )
    1. PG

      shane March 21st

      thx Alecu

      ( Reply )
  95. PG

    Vic March 26th

    I will be starting to use CodeIgniter, so this post really helped a lot in clearing most questions I have. Thanks!

    ( Reply )
  96. PG

    Mo`a March 30th

    great tutorial,
    for anyone that wants to continue learning, check the official guide.
    http://codeigniter.com/user_guide/toc.html
    It’s really one of the best I’ve seen, almost like a tutorial , not a boring thousand of pages documentation manual.

    ( Reply )
  97. PG

    Murray Williams April 1st

    Awesome tutorial this is my first go at the MVC way of doing things and it really makes sense.

    I have a problem thou when creating my view I get the following error

    Parse error: syntax error, unexpected T_ENDFOREACH in C:\xampp\htdocs\codeignitor\system\application\views\helloworld_view.php on line 14

    My code looks like this

    db->get(’data’);

    if ($query->num_rows() result();
    }
    }
    }

    ?>

    Any idea?

    ( Reply )
  98. PG

    Nayana Adassuriya April 6th

    Really help full. thanks lot.

    hope you will do lot for us.

    i think it is batter if you can make a tutorial for complete project.
    like how to integrate CSS and Javascript with the applications with standers.

    thanks
    Nayana Adassuriya

    ( Reply )
  99. PG

    mahabub April 7th

    thanks boss
    but why u play with this line
    if ($query->num_rows() > 0)

    ( Reply )
  100. PG

    James April 21st

    Good Stuff

    ( Reply )
  101. PG

    Danno April 22nd

    Thank you, thank you, thank you thank you, and a bigger THANK YOU!!!!!
    I have been 3 days trying to figure this stuff out and couldn’t find answers anywhere. You answered all of my questions in about 5 to 10 minutes of reading your tut.
    Thanks again – - – YOU LEGEND!!! :)

    btw – New Zealand is a beautiful country. Was there just before Christmas in Christchurch. Lovely place. :)

    ( Reply )
  102. PG

    Dixon April 25th

    Awesome tutorial! I just started using CodeIgniter and I’m loving it so far…much easier to use than writing all of this every time you do a project!

    Thanks!

    ( Reply )
  103. PG

    Himel khan April 30th

    code igniter is the best frame work i my web development life.

    ( Reply )
  104. PG

    balakris May 4th

    how to add and use helper

    ( Reply )
    1. PG

      Zoran May 4th

      You can add a helper by simply loading it in the autoload.php file which is located in the application/config folder. Go to the line:
      $autoload['helper'] = array(’url’, ‘form’, ‘another helper’); and add them like this. This way they are available to every controller. Otherwise if you want a helper in one controller, then in the construct function of the controller add this: $this->load->helper(’name of the helper’). Helpers are set of functions, look through the manual and see what functions each helper has. For example if you load the url helper, then in some controller function you can use its function redirect like this: redirect(’name_of_controller/action’); or in the view:
      anchor(’controller/action, ‘Name of the link’). If you need more help just write here :) . And one more thing to add is that i am sick and tired of people fighting about which framework is better. They are all good if you can work with it. It is really a personal choice. Every framework has good and bad sides, it is up to the person which one will use.

      ( Reply )
  105. PG

    Pizdin Dim May 5th

    Excellent introduction, thank you. At the risk of coming across as a complete “noob”, which I am as far as CI goes, why the convention of having class names and their files names capitalized but having the view files in lower case? This seems confusing to me, but I assume it must make sense to some of you. So why this inconsistency?

    ( Reply )
    1. PG

      Zoran May 6th

      Class names should be capitalized, but not their files. For example you can have controller like this: class Somecontroller extends Controller… and the file will be somecontroller.php… Also models: the class: class MPost extends Model… and the file is mpost.php. The views are just files, they are not classes, so that is why you save them as some_view.php. If you know bit of php, try and search through the system files and you will understand more about it. Also it is good idea to create one main controller like MY_Controller.php in the application/libraries folder and put inside all the things that you can share between other controllers and then the controllers will go like this:
      class Somecontroller extends MY_Controller… in the main one you can place authentication, session_start.. so it is available to other controllers.

      ( Reply )
      1. PG

        Pizdin Dim May 6th

        Zoran, thanks for that explanation. While I understand the “rules” I’m wandering why that convention was chosen in the first place because it’s illogical to me.

        Why aren’t all the classes lowercase?

        Their methods certainly seem to be, so why bother forcing the developer to use additional effort to remember to capitalize the class name? It’s extra work but it doesn’t add any value.

      2. PG

        ludilo May 22nd

        Je li lakse bilo da ste govorili na srpsko-hrvatskom (i naklapali na makedonskom) ?

      3. PG

        Zoran June 16th

        I think it’s not fair to talk my native language for the other people here

  106. PG

    Zoran May 6th

    @Ben Thank you for this introduction, i have been using cakephp for a while but always was coming to some problems with it, now i am using CI and did some professional projects with it, cause it allows me to extend it easily, place code that i want, it is the most flexible framework out there FOR ME! I tried Kohana also, but you have to learn it from the source code, cause their documentation sucks and i don’t have time to waste on stuff like that.
    Any questions about CI, i am willing to help anyone.
    Zoran from Macedonia.

    ( Reply )
  107. As a good resource for CodeIgniter, you can check my website: CodeIgniter Directory. Click on my name for the link.

    ( Reply )
  108. PG

    mike May 30th

    The tutorial doesn’t work.

    ( Reply )
    1. PG

      blackhorse66 June 4th

      The tutorial is really great. But with some typos like some friends already pointed out.

      First in this class

      load->model(’helloworld_model’);

      $data['result'] = $this->helloworld_model->getData();
      $data['page_title'] = “CI Hello World App!”;

      $this->load->view(’helloworld_view’,$data);
      }
      }
      ?>

      $data['result'] = $this->helloworld_model->getData();

      Should be

      $data['result'] = $this->helloworld_model->getData();

      ( Reply )
      1. PG

        blackhorse66 June 4th

        Second,

        db->get(’data’);

        if ($query->num_rows() > 0)
        {
        //show_error(’Database is empty!’);
        }else{
        return $query->result();
        }
        }

        }
        ?>

        if ($query->num_rows() > 0)

        should be

        if ($query->num_rows() == 0)

  109. PG

    artlover June 23rd

    GREAT Article! Thanks!!

    We also need same for Zend Framework! PLEASEEEEEEEEE!!!

    ( Reply )
  110. PG

    artlover June 23rd

    why do I get this error :(

    Fatal error: Call to undefined method CI_DB_mysql_result::numrows() in C:\wamp\www\ci\system\application\models\helloworld_model.php on line 15

    ( Reply )
    1. PG

      artlover June 23rd

      okay, I found it;
      my mistake :D
      if ($query->num_rows() < 0) {

      ( Reply )
  111. PG

    Mohammed June 23rd

    Great tut.. I wish you could continue the CakePHP series.

    ( Reply )
  112. PG

    Mike June 26th

    There are also some good tutorials over at http://mikethecoder.com/search/node/getting%20started%20with%20codeigniter

    Disclaimer: I wrote them.

    ( Reply )
  113. PG

    DemoGeek July 2nd

    CodeIgniter really helps you get things up and running in a really short span of time. There are some programming nuisances that can be abstracted further (read Kohana) but still CI is one of the simplest and best frameworks to get you up and running with your app in a short span of time. Find a better IDE and you’ll love to be on the CI world (I prefer Coda, of course!)

    ( Reply )
  114. PG

    Neel July 19th

    I am started learning codeigniter i think your tutorial will help me alot to boost my knowledge

    ( Reply )
  115. PG

    jamie July 28th

    This tutorial has got plenty of errors…so warning to anybody who starts with is TUT they are better going to the CI website!!

    I’m sorry but 3 errors is too much, their very simple errors i would of thought anybody with a working knowlegde of php (which i havent got) could of spotted these errors straightaway

    there is an error in the model,view and controller section so if the author would check his work next time he might write a good tut

    ( Reply )
  116. PG

    govind August 7th

    # if ($query->num_rows() > 0)
    # {
    # //show_error(’Database is empty!’);
    # }else{
    # return $query->result();
    # }

    i think u have wrongly entered the code….

    I have made this changes in if statement to run….
    here is the correct code

    # if ($query->num_rows() > 0)
    # {
    # return $query->result();
    #
    # }else{
    # show_error(’Database is empty!’);
    # }

    Good stuff from u guys, but small mistake u have done in the tutorials…

    Thanks

    ( Reply )
    1. PG

      Jeffrey Way August 7th

      Good eye. Thanks!

      ( Reply )
  117. PG

    C K August 31st

    Rewrite code in htaccess didnot work for me.
    places the file in the root of my application folder.

    ( Reply )
  118. PG

    C K August 31st

    And i tried running the application like – http://localhost/codeig/helloworld/

    Got Internal Server Error.
    Rewrite is enabled in httpd.conf file.

    ( Reply )
  119. PG

    Maulik September 2nd

    I have been waiting for a great Codeignitor tutorial for the past 2 months! I am very excited to read this.

    ( Reply )
  120. PG

    arvin September 24th

    CodeIgniter official web reference is very good, but it lacks some tutorial like this. Thanks.

    ( Reply )
  121. PG

    hosmia October 3rd

    Whatever some people might think or say
    CodeIgniter rocks !!!
    i love the simplicity to make complex apps
    I am a big fan and some people are only good to post critics !!!

    Thanks

    ( Reply )
  122. PG

    affiliate tools October 6th

    I’m a huge fan of CI its seriously helped me save a ton of time developing apps that i’ve used for internet marketing also saved me a bunch from hiring programmers and did the work myself.

    ( Reply )
    1. PG

      Anes P.A October 8th

      Hello Friend ,
      I am a php programmer , but newbie in CI . I like to know You and
      make a good pal in CI …. Pls reply me if you prefer same.

      Bye anes

      ( Reply )
  123. PG

    Anes P.A October 8th

    Sir,
    I am a PHP Programmer But new in CI. I have Two errors Experienced in my Code …
    They are
    1) A PHP Error was encountered

    Severity: Notice

    Message: Undefined property: Helloworld_model::$db

    Filename: models/helloworld_model.php

    Line Number: 13

    2) Fatal error: Call to a member function get() on a non-object in D:\wamp\www\codeIgniter\system\application\models\helloworld_model.php on line 13

    How it can Remedy , if any one have idea pls Contact me and help
    my contact Id is anes.pa@gmail.com

    I am waiting For your good Response.

    ( Reply )
  124. PG

    Rency October 15th

    http://localhost/CItest/index.php/helloworld/ It is working for me.

    But I have created .htaccess file in my root folder called CItest and
    $config['rewrite_short_tags'] = TRUE;

    But I got a Blank page for this http://localhost/CItest/helloworld/

    Please help!

    ( Reply )
  125. PG

    Tius October 20th

    I’m new to CodeIgniter. Thanks for posting this article, really help me.

    ( Reply )
  126. PG

    Anand October 27th

    I have been using the CodeIgniter for the 1 months, it is great.
    I loved your tutorial, very helpful.
    Thank you

    ( Reply )
  127. PG

    Ace November 4th

    You just saved my job

    Thanks for NET TUTS AND CI

    ( Reply )
  128. PG

    Krishna November 4th

    this does not work. lots of mistake all over the code.

    ( Reply )
  129. PG

    Ben November 19th

    This tutorial is terrible. It has several errors that haven’t been updated even though it’s been mentioned in the comments since the start.

    In the controller, you need to do parent::Controller(); to get the $this->load to work.

    ( Reply )
  1. Arrow
    Gravatar

    Your Name
    November 19th