escape array?
Posted: Wed Mar 07, 2007 9:00 pm
I'm building an array through a loop,just a simple array... name[1], name[2], etc. How do you escape the contents of each array? mysql_escape_string won't work.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
How do you escape the contents of each arrayCode: Select all
for ($x=0;$x<count($arrMyArray);$x++) {
$arrMyArray[$x] = mysql_escape_string($arrMyArray[$x]);
}Code: Select all
array_walk($arrMyArray,"mysql_escape_string");Code: Select all
array_map("mysql_escape_string",$arrMyArray);Should be:onion2k wrote: Alternative way (Good if you need to carry out the same thing on more than one array):Code: Select all
array_map("mysql_escape_string",$arrMyArray);
Code: Select all
$arrMyArray = array_map("mysql_real_escape_string",$arrMyArray);