php mysql中如何往表中追加数据

php mysql中如何往表中追加数据,第1张

update table set field=concat(' ', field, '072110003') where field='072110001'

应该是

update table set field=concat_ws(' ', field, '072110003') where field='072110001'

或者

update table set field=concat(field, ' ', '072110003') where field='072110001'

对于需要一次添加多个值,并且都用' '隔开的话,用第二条语句比较方便。 一次只用一个的话,concat比较简单而且不同数据库通用。

//上面要有连接数据源的内容$link

$dpassword=$_POST[dpassword]

$sql="select * from test where dpassword='$dpassword'"

$result=mysql_query($sql,$link)

$row=mysql_num_rows($result)

if($row <1){

echo "密码错误"

}else{

$sql="delete from test where dpassword='$dpassword'"

mysql_query($sql,$link)

echo "删除成功"

}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/8579319.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-18
下一篇2023-04-18

发表评论

登录后才能评论

评论列表(0条)

    保存