Home > Backend Development > PHP Tutorial > php累加数据到mysql

php累加数据到mysql

WBOY
Release: 2016-06-13 11:39:26
Original
1093 people have browsed it

php追加数据到mysql
php追加数据到mysql

在mysql里的一个表user中有个name的字段
表中已经有一条记录
id字段值是1
name字段的值是"周"
我现在想追加"杰伦"两个字到这个字段中
也就是让这条记录的name字段的值从原来的"周"变成现在的"周杰伦"
请问要怎么操作呢?
如何写代码?
用代码
$sql="update user set name = name + '杰伦' where id='1'";
mysql_query($sql);
以后name字段的值却变成"0"了。

追加数据 php mysql
Related labels:
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