CURD operations in ThinkPHP and ThinkPHPCURD operations _ PHP Tutorial

Source: Internet
Author: User
The CURD and ThinkPHPCURD operations in ThinkPHP. What are the CURD operations and ThinkPHPCURD operations in ThinkPHP? Php queries multiple records and returns a two-dimensional array $ resultM (admin)-select (); $ resultM (admin)-where (id2)-select (); $ result: CURD and ThinkPHPCURD operations in ThinkPHP
 Select (); $ result = M ("admin")-> where ("id> 2")-> select (); $ result = M ("admin ") -> where ("id> 2")-> order ("id desc")-> limit ("0, 5")-> field ("id, username, psssword ") -> select (); $ result = M ("admin")-> where ("id> 2")-> group ("messageId ") -> having ("messageId> 3")-> order ("id desc")-> limit ("0, 5")-> field ("id, username, psssword ") -> select (); // query a record and return a one-dimensional array $ result = M ("admin")-> find (); $ result = M ("admin ") -> where ("id = 2 ")-> Find (); // put the data to be processed in the array data $ data = array (" username "=> 'wang ', "password" => "123456"); // add a record, returns the number of affected rows $ updateRowNum = M ("admin")-> add ($ data); // delete a record, returned number of affected rows $ updateRowNum = M ("admin")-> where ("id = 2")-> delete (); // modify the data in the new array new_data $ new_data = array ("username" => 'Wang _ new', "password" => "123456_new"); // modify the record, returned number of affected rows $ updateRowNum = M ("admin")-> where ("id = 2")-> save ($ new_data); // run the select statement (Two-dimensional array is returned for all rows or rows) $ result = M ()-> query ("select * from admin a, user u where. id = user. aid "); // execute insert, update, and delete statements, and return the affected rows $ updateRowNum = M ()-> execute (" insert/update/delete Statement "); // calculate the number of queried rows (generally used for select statements) $ row = M ("admin")-> select ()-> count (); $ row = M ("admin ") -> where ("id> 3")-> select ()-> count ();?>

Why? Php // query multiple records, returns a two-dimensional array $ result = M ("admin")-select (); $ result = M ("admin ") -where ("id2")-select (); $ result =...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.