Monday 15 February 2016

Codeigniter Quries | php Quries

You can call with other names of the queries like PHP Codeigniter queries, Codeigniter joins query, Codeigniter 3 query, Codeigniter query string, Codeigniter query database, Codeigniter query string parameters, Codeigniter query result, Codeigniter query helper and many many other names. Codeigniter is the PHP framework that uses the pattern for database records. This pattern allows information to be retrieved, inserted and updated in your database with minimal scripting. Database connections are too easy to connect with database most of the things are already done in the framework we will show you that in later tutorials. This framework uses the pattern of MVC that means model, view, and controller. Codeigniter Queries | PHP Queries
We can use the crud by using the MVC method.

Codeigniter Quries | php Quries

  • Selecting Data
  • Inserting Data
  • Updating Data
  • Deleting Data

php Quries vs codeigniter quries

Select Data:

selecting data from multiple tables in MySQL, why choose MySQL, how to retrieve data from database in PHP using MySQL, PHP MySQL select, MySQL select where, how to display data from database in PHP, PHP MySQL query, how to fetch data from database in PHP and display in table are the same names of retrieving the data. In custom PHP, we create the MySQL query and execute that query same procedure in CodeIgniter is and we will create

CodeIgniter syntax
$query = $this->db->get("tableName");
php syntax/ mysql syntax
Select * from tableName;

we can also use the limit in the query like

CodeIgniter syntax
$query = $this->db->get("tableName", 10, 20);
php syntax/ mysql syntax
Select * from tableName limit 20, 10;

Insert Data

insert query example in MySQL, how to insert data in MySQL using PHP, how to insert data in Mysql using java, how to insert data in Mysql workbench, how to insert data in Mysql using JSP, how to insert data in MySQL using PHP form, how to insert data in Mysql using HTML form, how to insert data in MySQL using PHP Codeigniter are the same names you can call to insert data into the database. We can insert data in tables as the table fields are created  also with same data types. we  can insert an array of data or  just by putting numbers of data.

CodeIgniter syntax

$data = array(
  'title' => 'tableName,
  'name' => 'myname',
  'date' => 'mydate',
);
$this->db->insert('tableName', $data);
PHP syntax/ MySQL syntax
insert into tableName(title, content, date)values('mytitle', 'mycontent', 'mydate');
first parameter  elements are the table fields name and the seconds are the variables or values.

Updating Data

MySQL update syntax, how to update data in MySQL using java, how to update data in MySQL using PHP, MySQL update multiple columns, MySQL update select, MySQL update multiple rows, MySQL update join, update MySQL version these all are the same names you can call it. Updating data mean we already had entered the data and now we want to update that entered  data.

CodeIgniter syntax
$data = array(
               'title' => $title,
               'name' => $name,
               'date' => $date
            );
$this->db->where('id', $id);
$this->db->update('mytable', $data);

PHP syntax/ MySQL syntax
UPDATE my table
SET title = '{$title}', name = '{$name}', date = '{$date}'
WHERE id = $id;

Deleting Data

deleting data from MySQL database using PHP, how to remove duplicate data in MySQL, remove data from the MySQL table, MySQL remove column, MySQL removes primary key, MySQL removes all rows, remove me centos, remove me mac you can say it like this. Deleting data mean we are removing the entered data from our database so for this purpose we require the id or something like that to which we can compare and then delete the data.

CodeIgniter syntax
$this->db->delete('mytable', array('id' => $id));
PHP syntax/ MySQL syntax
DELETE FROM mytable
WHERE id = $id;
If you  people have any query about Codeigniter Queries | PHP Queries you can ask in the comment box. You can further read on the next stage it will increase your level of development.
You can Learn about the Joins between two or more tables....!

This Post Was Last Updated On September 30, 2016, By Author: Mahira Khan.

0 comments:

Post a Comment

Item Reviewed: Codeigniter Quries | php Quries Rating: 5 Reviewed By: admin