CodeIgniter
CodeIgniter
Framework is a collection of instructions collected in a function and class with a function to facilitate the developer in the call without having to write the same program syntax over and over again. Source code will look cleaner and more structured.
Codeigniter is a php framework that is open source and certainly free for every use, The purpose behind the development of a framework to facilitate the programmer in building a web-based applications. The method used is MVC (Model, View, Controller). Webserver Packages (AppServ, XAMPP, EasyPHP, WAMP, etc) & Code Igniter Codeigniter (CI) is a PHP framework, aimed at people who want to build websites using PHP. Using a view-controller-model architecture that separates the logic and display sections of the program, CI is quite "fun" to use. Not difficult especially you have mastered the basic principles of OOP in PHP.
The concept that separates every major component into 3 MVC components is
Database is a set of data that has been arranged in such a way with the provisions or certain rules that are mutually related between several classes and components so as to facilitate the user in managing it also makes it easier to obtain information. In addition, those that define the database as a collection of interconnected files, tables, or archives stored in electronic media. Some of the benefits of the database is one of them is the database has the ability in selecting data to become a group that sorted quickly. This is what ultimately can produce the information needed quickly too.
localhost/phpmyadmin
. Create a new database name to your liking, click new at the right corner of the phpmyadmin view.CREATE TABLE IF NOT EXISTS tb_buku
(id_buku varchar (10) NOT NULL,
title_buku varchar (50) DEFAULT NULL,
stock_buku year (4) DEFAULT NULL,
PRIMARY KEY (id_buku ))
ENGINE = MyISAM DEFAULT CHARSET = latin1;
Here is a little analysis of the three SQL commands "create table" before the following is an explanation of the attributes - supporting attributes that follow the main command "create table" is:
Not Null is a field property that provides a condition for the field to be null or non-existent.
Auto_increment is a special field property for Primary Key that causes the field to have the ability to increase automatically continuously as the number of data stored in the table increases.
Default Null is a field property that gives a condition to the field may be null or can not be entered.
Primary Key is a field that specifically becomes a priority or identifies each record line contained in a table.
Key is a field that becomes a reference search data in a database table, where the field is also stored in the database index so that easier search.
Engine is a table property that defines the type of storage used to store data for each table.
Default Charset is a character type that is configured against the table.
INSERT INTO `tb_majalah`
(`id_majalah`, `Judul_majalah`, `Stok_majalah`)
VALUES ('14', 'BOLA.net', '2008'),
('22', 'Travelling', '2010');
C:\xampp\htdocs\CodeIgniter\application\config\config.php
, which is useful to begin configuring the CodeIgniter Framework.C:\Xampp\Htdocs
.$ config ['base_url'] = "http://example.com/";
$ config ['base_url'] = "http://localhost/CodeIgniter/";
Because in this tutorial we will build CI in our local server. Localhost is the name for the local server that is on our computer, and basically the computer is the server, and the server is the computer.
application/config/ database.php
$ db ['default'] ['hostname'] = "localhost";
$ db ['default'] ['username'] = "root";
$ db ['default'] ['password'] = "";
$ db ['default'] ['database'] = "db_ci";
<?phpclass
Buku_model extends Model
{
function Buku_model()
{
parent::Model();
}
db->select('*');
$this->db->from('tb_buku');
$this->db->order_by('id_buku','DESC');
$data = $this->db->get('');
return $data;
}
}
?>
Then Save with magazine_model.php name. You must save it in the folder C: \ xampp\htdocs\ CodeIgniter\application\models
<?phpclass
Buku_con extends
Controller
{
public
function Buku_con()
{
parent::__construct()
;$this->load->model('buku_model');
}
public function getBuku ()
{
$data['title'] = 'menampilkan isi buku';
$data['detail'] = $this->buku_model->getBuku()
;$this->load->view('buku_view', $data)
;
}
}
?>
Then Save with majalah_con.php name. You must save it in the folder C: \xampp\htdocs\ CodeIgniter\application\Contoller
Data Buku
<?php
foreach($detail->
result() as $rows) :
echo $rows->id_majalah;
echo "
";
echo $rows->judul_majalah;
echo "
";
echo $rows->stok_majalah;
echo "
";
endforeach
?>
Then Save with majalah_view.php name. You must save it in the folder C: \ xampp \ htdocs \ CodeIgniter \ application \view