php如何向数据库中的某串数据后追加内容【急】

WBOY
Release: 2016-06-06 20:31:15
Original
1442 people have browsed it

php小白想做个临时用的小工具
php+myspl,SAE 上的。
希望能向某行的tag列里不断追加内容

$sql = "UPDATE tag SET tag =concat(tag,'$biaoqian') WHERE id = '$xuehao'"; 
Copy after login
Copy after login

然后什么用也没有
请问应该怎么写才能实现
我也想过先读取再拼接。。。但是发现自己根本不会读取某行某列的内容ORZ

完整的代码

学号:  "; ?> tag: "; ?> getData( $sql ); $biaoqian = $_POST['biaoqian']; $xuehao = $_POST['xuehao']; $sql = "UPDATE tag SET tag =concat(tag,'$biaoqian') WHERE id = '$xuehao'"; $mysql->runSql($sql); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $mysql->closeDb(); echo $mysql->errmsg(); 
Copy after login
Copy after login

回复内容:

php小白想做个临时用的小工具
php+myspl,SAE 上的。
希望能向某行的tag列里不断追加内容

$sql = "UPDATE tag SET tag =concat(tag,'$biaoqian') WHERE id = '$xuehao'"; 
Copy after login
Copy after login

然后什么用也没有
请问应该怎么写才能实现
我也想过先读取再拼接。。。但是发现自己根本不会读取某行某列的内容ORZ

完整的代码

学号:  "; ?> tag: "; ?> getData( $sql ); $biaoqian = $_POST['biaoqian']; $xuehao = $_POST['xuehao']; $sql = "UPDATE tag SET tag =concat(tag,'$biaoqian') WHERE id = '$xuehao'"; $mysql->runSql($sql); if ($mysql->errno() != 0) { die("Error:" . $mysql->errmsg()); } $mysql->closeDb(); echo $mysql->errmsg(); 
Copy after login
Copy after login

试下$sql = "UPDATE tag SET tag =concat(tag,'$biaoqian') WHERE id =".$xuehao;

tag列是否为字符串类型,如果是的话理论上是没问题的

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 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!