Redbean: Getting Started (1), getting started with redbean

Source: Internet
Author: User

Redbean: Getting Started (1), getting started with redbean

<? Php require_once 'rb. php '; $ tableName = "link"; // link database R: setup ("mysql: host = localhost; dbname = hwibs_model", "root ",""); // create a table (or instantiate a table) $ handler = R: dispense ($ tableName ); ###################################### add ## #####################################/* same [instantiate multiple tables] list ($ handler_1, $ handler_2) = R: dispenseALL ("test_1, test_2"); * // assign a value to the field using the object method //: Note: if the field does not exist, after the store method, the corresponding field is automatically added, and the corresponding field is automatically set based on the field value. Field Type: $ handler-> name = "haha"; $ handler-> url = "isxiugai"; $ handler-> plushtime = time ()-5000; // if the field name contains an underscore, it can be named by the hump method. It will be automatically converted to the underscore $ handler-> isMyName = false; // = is_my_name // execute, this static method returns the auto-incremental id value (single) $ inser_id = R: store ($ handler ); ##################################### query ## ################################## // obtain the record handle (parameter 1 is the table name, parameter 2 is the id value). The returned value is the object set // If the id does not exist, 0 // is returned. Note that the obtained handle can be used to delete $ bean = R :: loa D ($ tableName, 4); // obtain a single $ beans = R: loadAll ($ tableName, array (1, 2, 3, 4 )); // obtain multiple ################################### ##################################### // 1. note: The only difference between modification and add is id. If the id is not empty, it is modified; otherwise, it is added! // 2. If the id does not exist, it will not be added or modified! Therefore, before modification, you need to use load to determine whether foreach ($ beans as $ k => $ v) exists) {$ beans [$ k]-> url = rand (, 5555); // test [cyclically assign a random number to the url of each record object]} R :: storeAll ($ beans ); // execute the modification #################################### # delete #####################################/ /delete a single:: null var_dump (R: trash (R: load ($ tableName, 1) is returned for success or failure; // Delete multiple: if there is a nonexistent, only the existing objects will be deleted, and null var_dump (R: trashAll (R: loadALL ($ tableName, array (117,118) will be returned for success or failure )))); ####### ############################# Other ######### ########################### // clear all data in the table:: It is equivalent to truncate, because it will reset the auto-increment pointer // R: wipe ($ tableName); // delete all the tables in the database. [This function is speechless, mao] // var_dump (R: nuke (); // close the link R: close ();?>

 


A c Entry

It is not an error. It does not affect the project settings.

Who can recommend a getting started tutorial on FPGA?

Course on designing a digital system using OpenGL (version 2) Xia Yuwen: This is the basis of grammar. This is an electronic version.
Go deep into simple gameplay FPGA (with a CD) Wu houhang's video tutorial experience
Altera FPGA/CPLD design (basic) (version 2nd), which includes introduction to altera devices and the use of quartus
Advanced FPGA/CPLD design (advanced) (2nd)
Design and verification: Hu Jihua, and Wang Cheng: This is a good book. It's good to read the electronic version.
By Kriz, advanced FPGA design structure, implementation and optimization, Meng xianyuan translation is said to be very advanced.

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.