![]() |
escape strings
I'm setting up a client log in system and im trying to escape strings so that special characters dont create an error. But I know im doing it wrong, and the manual isn't really helping
PHP Code:
edit: this is the part where i define $cnx and clientID PHP Code:
|
Well, first of all, name your variables better. ;-) If you're going to look back at your clients code after 2 projects and 3 months ... you MUST know what it all means. So, instead of $cnx I would name it $connectionID or $connID.
The part you are trying to solve, I guess, is the query part. $cnx-> indicates that it is an object, which I don't see created anywere. (using __construct, autoload or even new className) The thing you want, is to escape the function with, lets say, addslashes or mysql_real_escape_string(); printf and sprinf is what you should be using. printf imidiatly displays the string and sprintf just makes is whole. PHP Code:
|
Not to be a flamer but yeah the variable names :P
i would use printf in this case. |
| All times are GMT. The time now is 12:01 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0