Fuelphp series------Miscellaneous

Source: Internet
Author: User

1. SQL bound variable:

$title = ' iat001 '; // Binding Variables $result $title) ->execute ();
// Direct Assignment $result = Db::query ("SELECT * from articles WHERE title =: Title")->param (' title ', ' iat001 ')->execute ();
// Binding Multiple Parameters $result = Db::query ("SELECT * from articles WHERE title =: Title and BODY =: Body")->parameters (array $title, ' body ' = ' body001 '))->execute ();

2. Data cache

// cached () Three parameters: Cache time, cache file, whether to store null value $result false) ->execute ();
// Delete articles cache files Cache::d elete ("articles"); // Delete all caches in the DB directory Cache::d elete_all ("db");

3. Business

Try {   //Transaction StartDb::start_transaction (); $result= Db::insert (' articles ')->set (Array(' title ' = ' iat001 ', ' body ' = ' body001 ')) -execute (); //Custom return informationDb::escape (' ERROR: '.$msg); //End of transactionDb::commit_transaction ();} Catch(Exception $e) {    //Transaction RollbackDb::rollback_transaction (); //Rollback Prompt Information   $e-getMessage ();}

Fuelphp series------Miscellaneous

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.