指定字段:

$historyinfo = Healthy::find()->select(['healthy_id','pet_name','hardware_name','hardware_color','remove_binding'])->where(['user_id'=>$user_id,'is_activation'=>'2'])->asArray()->all();

获取添加数据的id:

 $id = $model->attributes['healthy_id'];
 

Yii2框架查询指定字段和获取添加数据的id的更多相关文章

  1. Mybatis-Plus中使用max、sum聚合函数、只查询指定字段、查询语句多个OR处理

    聚合函数查询 可以使用以下方法 QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.select(" I ...

  2. MongoDB查询指定字段(field)返回指定字段的方法

    使用MongoDB的时候需要只查询指定的字段进行返回,也就是类似mysql里面的 SELECT id,name,age 这样而不是SELECT *.在MongoDB里面映射(projection)声明 ...

  3. mybatis-plus查询指定字段

    show me the code :mybais-plus版本:3.1.1 1,排除某些字段,可以同时排除多个字段排除多个字段写法: .setEntity(new User()) .select(c ...

  4. 从零开始,搭建博客系统MVC5+EF6搭建框架(2),测试添加数据、集成Autofac依赖注入

    一.测试仓储层.业务层是否能实现对数据库表的操作 1.创建IsysUserInfoRepository接口来继承IBaseRepository父接口 namespace Wchl.WMBlog.IRe ...

  5. Mysql查询某字段值重复的数据

    查询user表中,user_name字段值重复的数据及重复次数 select user_name,count(*) as count from user group by user_name havi ...

  6. Spring Data MongoDB 查询指定字段

    DBObject dbObject = new BasicDBObject(); //dbObject.put("name", "zhangsan"); //查 ...

  7. yii 只查询指定字段

    $cri = new CDBcriteria(); $cri->addCondition( ' hid = '.$hid.' ' ); $cri->select = 'id,propert ...

  8. yii框架中获取添加数据后的id值

    Yii::$app->db->createCommand()->insert('month4_user',['openid'=>$openid,'integ'=>0])- ...

  9. laravel 查询指定字段的值

    $this->model->where('id',$id)->value('user');

随机推荐

  1. [转载]触发ASSERT(afxCurrentResourceHandle != NULL)错误的原因

    触发ASSERT(afxCurrentResourceHandle != NULL)错误的原因 Debug Assert error afxwin1.inl line:22 翻译参考 http://w ...

  2. jquery send(data) 对data的处理

    // Convert data if not already a string if ( s.data && s.processData && typeof s.dat ...

  3. socket详解

    <?php /* * * socket主要翻译为套接字 * socket_accept — Accepts a connection on a socket * 接受一个socket链接 * s ...

  4. Yii源码阅读笔记(二十一)——请求处理流程

    Yii2请求处理流程: 首先:项目路径/web/index.php (new yii\web\Application($config))->run();//根据配置文件创建App实例,先实例化y ...

  5. 远程出发jenkins jobs

    wget -O - -q "http://jenkins_server/job/ttt/buildWithParameters?TEST1=Value" wget -O - -q ...

  6. Linux用户配置sudo权限

    Linux用户配置sudo权限 创建sudo权限用户 #useradd supope #passwd supope #visudo #supope         ALL=(ALL)       AL ...

  7. SQL Server 索引中include的魅力(具有包含性列的索引)

    2010-01-11 20:44 by 听风吹雨, 22580 阅读, 24 评论, 收藏, 编辑 开文之前首先要讲讲几个概念 [覆盖查询] 当索引包含查询引用的所有列时,它通常称为“覆盖查询”. [ ...

  8. AngularJS Best Practices: SEO

    Google can execute AJAX & JavaScript for indexing, you can read the below link for more detailed ...

  9. docker interact example

    此为docker 第一篇,插下杂七杂八的东西,好找,就这么简单,,,, yum -y install docker-io //install cp /var/tmp/cap.data /var/lib ...

  10. SVN 多项目管理(强烈建议每个项目建一个库)

    Subversion的目录结构是很自由的,所有的规划都必须是你自己规定,考虑一个 subversion仓库的目录树,你可以把任何一个目录认定为一个项目,你可以只checkout这个目录下的所有文件进行 ...