Need advice on what to name functions that do this
- Perform operations on strings before inserting into db to protect from MySQL injection
- Converts HTML special characters
Ex:
enter_db()
exit_db()
However, these function names sound kinda corny. Any suggestions or advice on other names? Thanks!
My database connection generally resides in a wrapper, so there’s a bit of context for the functions:
It sounds like you’re making these functions external as part of a procedural library, and they do a little extra work on the string, so I’d probably go with something like:
I’m a PHP programmer, and PHP has a built in
htmlspecialchars()function. It’s got a nice simplicity to it. If you’re not using PHP, I’d simply makehtmlSpecialChars()the conversion function, or possiblyhtmlEntities().