Home  >  Article  >  Backend Development  >  php累加数据到mysql

php累加数据到mysql

WBOY
WBOYOriginal
2016-06-13 11:39:26979browse

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
Statement:
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
Previous article:yii ,sql, 增删节查Next article:大家伙儿说说Drupal