注意事项:
1.先在database.php中配置好数据库
2.只要是数据库操作必须引用 use/think/Db;严格区分大小写。
下面是方法:

//所有查询必须  use/think/Db;
        /* 1 配置数据库
         * 2 使用DB 命名空间
         * 
         */ 
             /****************tp5中使用原生语句*******************/
        //query 用于查询 其他的用execute
        // 插入记录
//         $result = Db::execute('insert into sb_ad (ad_name, ad_content ,status) values (1, "456",1)');   
        // 更新记录
//        $result = Db::execute('update sb_ad set ad_name = "framework" where ad_id = 1 ');       
        // 查询数据
//        $result = Db::query('select * from sb_ad where ad_id = 1');
        // 删除数据
//         $result = Db::execute('delete from sb_ad where ad_id = 2 ');   
        //其它操作
        // 显示数据库列表
//        $result = Db::query('show tables from tpshop1');
//         清空数据表
//         $result = Db::execute('TRUNCATE table sb_ad');