YII learning, yii
CONFIG
tablePrefix sets the table prefix
MODEL
Set the table associated with MODEL
public function tableName(){
return {{%table_name}} table prefix plus table name format
}
Pagination:
use yiidataPagination;
$Page = new Pagination(['totalCount' => Total number of items,'pageSize'=>Number displayed on each page]);
Query:
There must be a model corresponding to the database name
Model name::find()->where(condition['status'=>1]);
$tombList
->offset($Page->offset paging)
->limit($Page->limit number of pages)
->all();
->all(); Search all
->one(); Query one
->count(); Query quantity
->average(field); Query the average
->min(field); Query the minimum value
->max(field); Query the maximum value
->scalar(); Query the value of the first row and column
->column(); Query the value of the first column of all results
->each(quantity); Repeated query results to deal with memory overflow
delete
Yii::$app->db->createCommand()->delete('table name','condition')->execute();
Revise
Yii::$app->db->createCommand()->update('table name', modify field ['status'=>1], 'condition')->execute();
Add to
Yii::$app->db->createCommand()->insert('table name', data)->execute();
http://www.bkjia.com/PHPjc/981701.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/981701.htmlTechArticleYII learning, yii CONFIG tablePrefix Set the table prefix MODEL Set the table associated with MODEL public function tableName(){ return { {%table_name}} Table prefix plus table name format} Pagination: use yii...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn