PHP如何操作一次数据库,让某个表一个字段递减一次

WBOY
Release: 2016-06-23 13:39:07
Original
1396 people have browsed it

表名:ces

id cid name    cun1   2  测试    啦啦啦2   2  测试1   啦啦啦3   2  测试2   啦啦啦
Copy after login

表名:cuns
cid title current 2   测试    3
Copy after login


比如我用PHP操作删除ces表id为1的字段,删除后,对cuns表中cid为2的字段的current字段递减


回复讨论(解决方案)

触发器,删除时候执行sql代码,具体怎么写百度下 很多,主要要考虑性能

楼上是一种,
还有一种你同时更新cuns表不就行了?
看你有什么要求

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!