Hello
I ask your help in adding into the MySQL cell containing an array
I want a query that appending a new value to a cell without damaging the existing value.
Thanks for the help!
Itzik
Hello
I ask your help in adding into the MySQL cell containing an array
I want a query that appending a new value to a cell without damaging the existing value.
Thanks for the help!
Itzik
I know the function but i forgot it :S
i did it by array_merge(), array_unique() and this least ysql query
Are you referring to updating a field in a row of a database table?
i think this is what you are referring to:
function escape_data ($data) {
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
return mysql_real_escape_string (trim($data));
}
mysql_query("UPDATE yourTableName SET yourRow=concat(yourRow, '".escape_data($newvalue)."') WHERE id='".$YourUniqueIdentifier."' LIMIT 1");
Where escape_data() is a function i use to sanitize the string being inserted
I don’t know what do you mean by ‘cell containing an array’ but if I am not wrong you should use update statement to update a cell data and the query will look like this:
UPDATE tblename SET fieldname=CONCAT(fieldname, ' ', 'new string') WHERE id=1;