Db::query ();D b::execute ();D b::table ()->select (), all data, two-dimensional array, the result does not exist when returning an empty array db::table->find (); one data, one-dimensional array, Returns Nulldb::table->value () when the result does not exist, returns an empty Db::table->column () when the result does not exist, returns a one-dimensional array, or, if there is a second argument, returns an array with the second number as the identity, when the result does not exist , return nulldb::table ()-> Table name plus table prefix db::name ()-> Ignore table prefixes
Add Data "Array"
Db::name ()->insert (); Returns the number of rows affected Db::name ()->insertgetid (); Get the last New Iddb::name ()->insertall (); Insert all data
Update Database "Array"
Db::name ()->where ()->update (); Returns the number of rows affected by Db::name ()->where ()->setfield (' name ', ' millet '); A field that updates data returns the number of rows affected Db:name ()->where->setinc (' num '); num field name each time self-increment 1db:name ()->where->setinc (' num ', 5); num field name per Increment 5db::name ()->where ()->setdec (' num '); num field each time self-decrement
Delete
Db::name ()->where ()->delete (); Returns the number of rows affected if the condition to be removed is the primary key, you can not write Wheredb::name ()->delete (1); Delete a id=1 record
Conditional constructors
Db::name ()->where ()->buildsql (); Returns the SQL Statement db::name ()->where ("Id=1")->buildsql (); Delivery conditions Db::name () WHERE ("id", 1)->buildsql (), pass the field name, and want to use the value Db::name ()->where ("id", "<>", 1)->buildsql (); The field name, expression, want to determine the value of Db::name ()->where (' id ', ' between ', ' 1,5 ')->buildsql (); IDs between 1-5, including 1 and 5db::name ()->where ([' ID ' =>1])->buildsql ();D b::name ()->where ([' ID ' =>[' in ', [1,2,3,4 ]])->buildsql ();
"Two conditions are the relationship of and"
Db::name ()->where ([' id ' =>1],[' name ' = ' Kaluo '])->buildsql (); EXP is the conditional expression db::name ()->where ("id", "EXP", "Not In ()")->buildsql ();
"Two conditions are the relationship of or"
Db::name ()->where ("id", "in", "No")->whereor (' name ', ' Buld ')->buildsql ();
where () is an array, is a string, is a parameter
# Note Information "The letters are compiled into the following symbols, etc." "condition is case insensitive"
# EQ =# NEQ <># lt <# ELT <=# gt ># EGT >=# between between * and *# notbetween not between * and *# in In (*,*) # notin NO TIN (*,*)
Expression::
Between
Inch
Chained operation
db::table ()->where (' id ', ' > ', Ten)->select (); Query all fields in the table "field method" Db :: Table ()->where (' id ', ' > ', ten)->field ("Name,id")->select (); Name,id field in Query Table "Order Method" db::table () Where (' id ', ' > ', ten)->field ("Name,id")->order ("id DESC")->limit (3,5)->select (); Query table for name,id fields, flashback sort , starting from the third article, Fetch 5 "page method" page (2,5) starting from the second page, showing five "db::table ()->where (' id ', ' > ', ')->field (" Name,id ")->order ("ID DESC")->page (3,5)->select (); Name,id field in query table, flashback sort, starting from the third page, Fetch 5 "group Group" Db::table ()->where (' id ', ' > ->field ("Name,id")->group ("' Group '")->select (); The Name,id field in the query table, grouped by group