Tag:Query Builder

  • Example of using query generator query() in yii2 framework

    Time:2021-4-3

    This article describes the use of query generator query () in yii2 framework. The details are as follows: Yii / db / query in yii2 provides us with rich methods to build complex SQL statements. The biggest difference between query () and create command is that the latter directly uses the SQL statements we have […]

  • A simple example of query builder for laravel framework

    Time:2019-11-30

    An example of this article describes the laravel framework query builder. To share with you for your reference, as follows: public function query(){ //New data //$bool = DB::table(‘wd_user’)->insert([‘username’=>’jack’]); //dd($bool); //New data并且获取到自增id //$id = DB::table(‘wd_user’)->insertGetid([‘username’=>’Tom’]); //dd($id); //Add multiple data //$bool = DB::table(‘wd_user’)->insert([[‘username’=>’a’],[‘username’=>’d’]]); //dd($bool); //Update data //$bool = DB::table(‘wd_user’)->where(‘uid’,7)->update([‘username’=>’tom’]); //dd($bool); // self increment //$bool = DB::table(‘wd_user’)->increment(‘age’,1); // […]