The following code is based on version codeigniter_2.1.3
Use PHP to implement simple additions and deletions to the database (pure code) please poke
Http://www.cnblogs.com/corvoh/p/4641476.html
codeigniter_2.1.3 and PHP5.6 compatibility issues please poke
Http://www.cnblogs.com/corvoh/p/4649357.html
Increase:
// Insert
Syntax: $bool = $this->db->insert (' table name ', associative array);
$data=array( ' username ' = ' mary ', ' password ' = ' Mary ',// Create an array of the user named Mary, whose password is Mary, and pass it to the variable $data); $bool=$this->db->insert (' user ',$data); Insert the $data into the user table of the database var_dump($bool); //Success returns ture
By deleting:
// Delete
Syntax:$bool = $this->db->delete (' table name ', where condition); $bool=$this->db->delete (' user ',array(' id ' =>3)); Delete the database. User list id=3 All information var_dump($bool); //Success returns ture
Change:
update$data =array( ' password ' =>12345,); $bool =$this->db->update (' user ',$data,array (' ID ' =>3)); Give the user password for the database. Id=3 to 12345
Var_dump ($bool); Success returns ture
Check:
get$res =$list =$this->db->get (' user '); Var_dump ($list); foreach ($item) {//Use foreach to list all user names $item, username; echo ' <br/> ';}
Using CI framework to implement simple additions and deletions in database