Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Saturday, March 18

How to Insert Update Delete Retrieve data using Codeigniter in MySQL Database


When you are going to create a codeigniter web application using database you can not create it without using the insert, update, delete and retrieve codes of codeigniter. In this tutorial we will show you How to Insert Update Delete Retrieve data using Codeigniter in MySQL Database.

Thursday, February 16

How to Remove index.php From url in Codeigniter using htaccess

codeigniter-remove-index-php
CodeIgniter urls are designed to be search-engine and human friendly.But, that by default 'index.php' which appears in the url of codeigniter applications is really awkward.To maintain the standards I always  remove the default 'index.php' from the codeigniter url so that the url becomes more search engine friendly and looks clean.
So today in this tutorial I will show you how to remove index.php from codeigniter url.
That 'index.php' can be removed from the codeigniter url by following some simple steps.First we will create an '.htaccess' containing codes to remove 'index.php' from the codeigniter url.We will save that '.htaccess' file on root of that codeigniter applications. We will also make necessary changes on the configuration files of that codeigniter application.It is as simple as bellow :

Step I - Download Codeigniter : You can download Codeigniter 3  from their official website - https://www.codeigniter.com/download .You can also Download Github repository of Codeigniter 3  - https://github.com/bcit-ci/CodeIgniter .

Step II - Create .htaccess File : The next step is create an '.htaccess' file.First open your favourite text editor and create a new text file.Now save it as ".htaccess" in the root directory of that codeigniter application. Some time the file saved as a text file. To avoid this problem type the file name within quotes.
codeigniter-remove-index-php

Now copy paste bellow code to the '.htaccess' file and save:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>  

Step III - Modify Config.php File : Now in the next step we will make some changes on the 'config.php' file. Go to application>>config folder of your codeigniter application.Open the file 'config.php'.
First Search for the bellow line in 'config.php'.

$config['index_page'] = 'index.php';

Replace this line with the bellow line

$config['index_page'] = '';

Again Search for the bellow line in 'config.php'.

$config['uri_protocol'] ='AUTO'

Replace this line with the bellow line

$config['uri_protocol'] = 'REQUEST_URI'

Now try to open your codeigniter application without 'index.php'. Hope it will open your application without 'index.php'. If your fell any problem on following those steps comment bellow. Thanks for reading this article. 

Wednesday, January 18

How to upload images using Codeigniter 3 and save them into MySQL database

codeigniter-image-upload

Image upload is the most important chapter in Web Development. I am creating Web applications from last 3 years using codeigniter and one of the most frequently used codes in my projects is uploading images and save them into the database.So today I will show you how to upload images using codeigniter 3 and save them on the database.