Home > Backend Development > PHP Tutorial > 点赞 每点一次向数据库增加1

点赞 每点一次向数据库增加1

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:27:27
Original
1529 people have browsed it

这样子行不能,不知怎么写,求指点

<code>$num += 1;
$data['like_count'] = $num;
M('Weizhan')->where($map)->save($data);</code>
Copy after login
Copy after login

回复内容:

这样子行不能,不知怎么写,求指点

<code>$num += 1;
$data['like_count'] = $num;
M('Weizhan')->where($map)->save($data);</code>
Copy after login
Copy after login

你这样写不对滴!
M('weizhan')->where($map)->setInc('like_count',1);

参考 Redis 计数器

一般都不会数据库计数

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template