You will find a huge amount of hurt if you try to put the escaped text into the database. Instead, store exactly what they typed in, and be sure to wrap it properly when presenting it. See Joel on Software for a reasonable method of approaching this from a coding standpint.
Also, avoid manually calling mysql_escape
. You should be using prepare
to create a SQL statement with placeholders, such as "INSERT INTO code (texty_part) VALUES (?)"
, and then running $sth->execute($texty_part)
to do the insertion.