Hi,
I was just doing some reading through threads about security issues and php. There were a few things that I would like clarified..
"As a general rule, always escape any variable which will be used in a query, where the value of the variable was obtained from "outside" e.g. a form post or a cookie - you'll feel generally more relaxed if you do...." - Exactly how do you 'escape' a variable?
Another post mentioned that you should not use quotes around any variables that have numeric values in a query. Does this mean I should be writing
?PHP Code:<?
$number = 3;
$sql = "select * from ages where age = $number ";
// rather then
$sql = "select * from ages where age = '$number' ";
?>





it messes things up in so many cases when its purpose was to make things "easier."
well, it'd be super easy if it didn't exist. you'd tell people one thing that would always work right with no if's and's or but's: use addslashes().




Bookmarks