0
我怎麼能concate這個字符串在MySQLConcate字符串MYSQL
desc=desc+$desct
每次我插入從PHP變量,該字符串添加到已經在數據庫,並與分隔字符串我想是||
領域遞減應該是這樣的
desc
10||30||90||710
說我要添加值20
desc
10||30||90||710||20
則遞減場應該是這樣的
我怎麼能concate這個字符串在MySQLConcate字符串MYSQL
desc=desc+$desct
每次我插入從PHP變量,該字符串添加到已經在數據庫,並與分隔字符串我想是||
領域遞減應該是這樣的
desc
10||30||90||710
說我要添加值20
desc
10||30||90||710||20
則遞減場應該是這樣的
使用MySQL CONCAT功能:
UPDATE tblName SET colName = CONCAT(colName, "||20") WHERE ...;
$mysql_desct = mysql_real_escape_string($desct, $mysqlconnection);
$query = "
UPDATE
tblFoo
SET
desc = Concat(desc, '||', '$mysql_desct')
";
mysql_query($query, $mysqlconnection) or die(mysql_error());
見:http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_concat
我會嘗試這得益於 – streetparade 2010-03-18 09:53:32
感謝我tryed和它的作品,有一個愉快的一天:-) – streetparade 2010-03-18 09:54:19