Home > Backend Development > PHP Tutorial > 先问个THINKPHP关于SAVE的问题

先问个THINKPHP关于SAVE的问题

WBOY
Release: 2016-06-23 13:58:48
Original
815 people have browsed it


如果我想实现  update table set a=a-1 where a>=1 这样的SQL

用THINKPHP是怎么写的? SAVE?


回复讨论(解决方案)

更新
 update($data,$options)
 

更新
 update($data,$options)
 


好吧,我看到底层类里面,有个方法会把要UPDATE的值转成数据库定义的类型了,上面的a-1是字符串,被intval转成0了

thinkphp有这类东西的处理,但也不算很完善,看下手册就能找到setDec

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template