PDA

View Full Version : possible to run an update query like this?


AN-net
06-20-2005, 11:25 PM
UPDATE tablex SET field1=addslahes(field1);

Andreas
06-20-2005, 11:28 PM
UPDATE tablex SET field1 = QUOTE(field1)

AN-net
06-20-2005, 11:38 PM
would i be able to use addslashes inside of QUOTE() or does QUOTE() do that?

also how would i use htmlspecialchars_uni on it?

Andreas
06-20-2005, 11:41 PM
addslashes() (http://www.php.net/manual/en/function.addslashes.php) is a PHP function, QUOTE() (http://dev.mysql.com/doc/mysql/en/string-functions.html#id2631984) a mySQL function.

htmlspecialchars_uni() is a vBulletin function.

AN-net
06-21-2005, 12:14 AM
is there anyway i can use htmlspecialchars_uni() like that or would i have to call everything from table and then run an individual query for each?

Paul M
06-21-2005, 12:24 AM
is there anyway i can use htmlspecialchars_uni() like that No, mysql will simply reject it as unknown. You would have to pull the records into an array, and then loop round them, converting the field in each row and updating the row back to the db.

AN-net
06-21-2005, 01:09 AM
uh...ty all

Marco van Herwaarden
06-21-2005, 07:01 AM
Maybe you can make it work using REPLACE().

But what are you trying to do? It makes no sense to me at all, if data is already succesfully inserted into the database, why do you want to run addslashes on it?