zoukankan      html  css  js  c++  java
  • tp5增删改查基本操作

            //插入数据
            $res = Db::execute('insert into phptab(info) values("小张")');
            dump($res);
            //修改数据
            $res = Db::execute('update phptab set info="你好tp" where id=1');
            //删除数据
            $res = Db::execute('delete from phptab where id=1');
            //查询数据
            $res = Db::query('select * from phptab');
            dump($res);
            // // 防注入操作
            $res = Db::execute('insert into phptab(info) values(:info)', ['info' => '你好tp']);
            $res = Db::execute('insert into phptab(info) values(?)', ["不太好"]);
            // PDO插入
            $res = Db::table('phptab')->insert(['info' => '哈哈哈']);
            // 更新
            $res = Db::table('phptab')->where('id', 2)->update(['info' => '迪迦']);
            $res = Db::table('phptab')->select();
            $res = Db::table('phptab')->where('id', 5)->delete();
            $db = Db::table('phptab');
            $res = $db->insert(['info' => '哈哈哈']);
            $res = Db::name('phptab')->insert(['info' => '哈哈哈']);
            //统计数量count
            $res = $db->count('info');
            dump($res);
            return 1;
  • 相关阅读:
    poj 2002 Squares 几何二分 || 哈希
    hdu 1969 Pie
    hdu 4004 The Frog's Games 二分
    hdu 4190 Distributing Ballot Boxes 二分
    hdu 2141 Can you find it? 二分
    Codeforces Round #259 (Div. 2)
    并查集
    bfs
    二维树状数组
    一维树状数组
  • 原文地址:https://www.cnblogs.com/xiaozhang666/p/11465310.html
Copyright © 2011-2022 走看看