zoukankan      html  css  js  c++  java
  • laravel增删改查(查询构建器)

    1.增

    $data = [
        'username' => 'xiaohong',
        'nickname' => '小红红',
        'email'    => '12356788@qq.com',
        'phone'    => '13554321234',
        'password' => md5('123456'),
        'login_status'=> 1,
    ];
    $res=DB::table('admins')->insertGetId($data);

    2.删

    $res=DB::table('admins')->whereIn('id',[10,11])->delete();

    3.改

    $data = [
              'nickname'=> '超级管理员',
              'email'   => 'itheima@qq.com',
            ];
    $res = DB::table('admins')->where('username','=','root')->update($data);    

    4.查

    $where=[
        ['id','>',5],
        ['id','<',10],
    ];
    $res=DB::table('admins')->where('nickname');
  • 相关阅读:
    Mysql配置文件解析
    Mysql的视图
    Setup和 Hold
    洛谷 P2257
    洛谷 P3455
    洛谷 P1447
    洛谷 P1155
    洛谷 P1262
    洛谷 P4180
    洛谷 P5540
  • 原文地址:https://www.cnblogs.com/xiaobiaomei/p/7904158.html
Copyright © 2011-2022 走看看