【数据删除及执行原生sql语句】

delete()  返回受影响的记录条数

$goods -> delete(30);   删除主键值等于30的记录信息

$goods -> delete(“10,12,13”);   删除主键值等于10 12 13的三条记录

$goods -> where(“goods_id>60”)->delete()   把符合条件的记录都给删除

执行原生sql语句

  1. 查询语句query()  返回一个二维数组信息
  2. 添加、修改、删除 execute()  返回受影响的记录条数

$goods = D(“Goods”);

$sql = “select * from sw_goods”;

$rst = $goods -> query($sql);

$sql = “select goods_category_id,avg(goods_price) from sw_goods group by goods_category_id having  avg(goods_price)>1000”;

$goods -> query($sql);

$sql = “update sw_goods set goods_name = ‘htc_two’ where goods_id=100”;

$goods -> execute($sql);

最新文章

  1. TSQL 字符串函数:截断和查找
  2. 初入网络系列笔记(3)HTTP协议最简单的掌握
  3. Unity贴图锯齿
  4. Docker入门教程(二)命令
  5. HDU 3791 二叉搜索树
  6. Observer - IO (File Monitor)
  7. 设置lable文本内容的行间距
  8. MySQL: InnoDB 还是 MyISAM? (转载)
  9. ISO 9141-2 and ISO 14230-2 INITIALIZATION and DATA TRANSFER
  10. yii2-admin 插件使用简要教程
  11. putty连接linux as5 输入密码后连接中断
  12. VS2010 快速写入注释小技巧
  13. Do not go gentle into that good night
  14. 一个简单链表的C++实现(二)
  15. qq客服问题
  16. 菜鸟的 Sass 学习笔记
  17. 初识Python.day2
  18. Linux 下Shell变量,环境变量的联系与区别
  19. JavaBean转xml
  20. Lattice Constants and Crystal Structures of some Semiconductors

热门文章

  1. shell中单引号、双引号、反引号的区别
  2. 2017.11.21 postgre更新时需要联合其他表的信息
  3. java泛型 7 泛型的基本介绍和使用
  4. kvaser leaf light v2 在Linux 下面的使用方法
  5. Android学习笔记(一)——Activity简介 和 View
  6. mac系统中搭建apache+mysql+php的开发环境,安装mysql后,登录报错:mac ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
  7. 简体字冯|docker-安装docker私有库
  8. 一个关于git push失败的解决方案
  9. cpu故障定位 top strace pstack
  10. YII安装步骤(windows)