We can use the crud by using the MVC method.
- Selecting Data
- Inserting Data
- Updating Data
- Deleting Data
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 createCodeIgniter 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(PHP syntax/ MySQL syntax
'title' => 'tableName,
'name' => 'myname',
'date' => 'mydate',
);
$this->db->insert('tableName', $data);
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 mytableIf 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.
WHERE id = $id;
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