I’m creating a log table which logs actions that affect the database, and I store the sql statements in a field called details.
Below is an example query where I try to insert a row into my log table but I run into problems with the details part, as I am inserting a query into the field and mysql interprets it as part of the actual query and errors
INSERT INTO `user_log` SET `log_dts`='2012-05-28 15:07:19', `user_id`='4', `details`='UPDATE `property` SET `timedeleted` = '2012-05-28 15:07:19' WHERE `propertyid` IN (1594930)'
How is it best to handle this?
Thanks.
edit: to add, the details field is a text field in the mysql db.
mysql_real_escape_string – d’uh