replace a value in a insert
how replace a value when开发者_JAVA技巧 I use insert mysql command ?
You can use the "on duplicate key update" syntax to update an existing row in an insert statement.
INSERT - creates a new value. UPDATE - Replaces/modifies an existing value.
If you're meaning that you want to only update the current value in the database and not insert a new value, you should use the UPDATE command: http://dev.mysql.com/doc/refman/5.0/en/update.html
If you actually do want to insert something into the database, but want to replace the value before it gets inserted, you could use PHP's str_replace() or preg_replace() function depending on what you need to do. I'm not sure what language you're using, but if it's .NET, you could use the Replace() method.
str_replace() - http://php.net/manual/en/function.str-replace.php
preg_replace() - http://php.net/manual/en/function.preg-replace.php
精彩评论