zoukankan      html  css  js  c++  java
  • PHP--TP框架----操作数据库

    //操作数据库

                       //$attr = $m->select(); //查询所有数据

                       //$attr = $m->select("p001,p002,p003");

                       //$attr = $m->find("p001"); //找特定的数据根据主键值找

                      

                       //where可以加查询条件

                       //$attr = $m->where("code='p001' or sex=true")->select();

                      

                       //table可以切换要操作的表

                       //$attr = $m->table("Nation")->select();

                      

                       //alias可以设置表的别名

                       //$attr = $m->alias("人员")->select();

                      

                       //field可以指定查询的字段

                       //$attr = $m->field("code,name")->select();

                      

                       //order可以加排序条件

                       //$attr = $m->order("Nation desc")->select();

                      

                       //group可以分组

                       //$attr = $m->field("Nation")->group("Nation")->select();

                      

                       //having可以加分组后的条件

                       //$attr = $m->field("Nation")->group("Nation")->having("count(*)>5")->select();

                      

                       //join可以连接多个表,在field里面要给字段加别名

                       $attr = $m->field("Info.Code as 代号,Info.Name as 姓名,Sex as 性别,Nation.Name as 民族名称")->join("Nation on Info.Nation = Nation.Code")->select();

                      

                      

                       var_dump($attr);

                      

                      

             }

  • 相关阅读:
    vue 首页问题
    springboot redis
    idea spring-boot总结
    mybatis
    springboot mybatis搭建
    spring mybatics
    后面公司里就通过maven从阿里云下载了, idea springboot+adep
    [Java] 解决异常:“The last packet sent successfully to the server was 0 milliseconds ago.
    [Linux] 由管道父进程向子进程发送数据 (父子间IPC)
    [Linux] 进程间通信--管道 pipe 函数详解 (出自 360百科)
  • 原文地址:https://www.cnblogs.com/yuyu1993/p/5724215.html
Copyright © 2011-2022 走看看