Created objects
1. Original mode (must do model file, even if it is empty also to be built)
$model=new \home\model\infomodel (); Var_dump ($model);
2.D () method (does not need to build a model file)
// $ name =d ("table name"); $model=d ("Info"); Var_dump ($model);
3.M () method (does not need to build a model file)
// $ name =m ("table name"); $nation=m ("Nation"); Var_dump ($nation);
manipulating databases
1. Call the Select method to query all data
$ainfo=$model->select ();
2. Call the Select party to find more than one data based on the primary key value
$ainfo=$model->select ("p001,p002,p003");
3. Call the Find method to find a specific piece of data based on the primary key value
$ainfo=$model->find ("P001");
Consistent operation
Where to add criteria to a query
$ainfo=$model->where ("code= ' p003 ' or sex=true")->select ();
Tables for table toggle Operations
$ainfo=$model->table ("Nation")->select ();
Alaias Setting the alias of a table
$ainfo=$model->alaias ("Personnel")->select ();
field specifies the column of the query
$ainfo=$model->field ("Code,name")->select ();
Order to sort query results
$ainfo=$model->order ("Nation desc")->select ();
Group Group
$ainfo=$model->field ("Nation")->group ("Nation")->select ();
Conditions after having and grouping
$ainfo=$model->group ("Nation")->having ("Count (*) >2")->select ();
Join joins multiple tables (note: Alias columns with duplicate names)
$ainfo=$model->field ("Info.code,info.name as Xingming,sex,nation.name,birthday") Join("nation on info.nation = Nation.code")->select ();
PHP TP Model