The code below is part of a class to escape strings, but should also accept an array, using array_map() to do the job. Unfortunately, passing an array results in the original, unescaped array being returned - can't figure out why? If you uncomment the echo statement, it is outputting the correct escaped string for each element of the array, so the callback is definitely happening.
public function escape_str($str)
{
if (is_array($str))
{
array_map(array('MYSQL_DB','escape_str'),$str);
}
else
{
if (get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
if (!is_numeric($str)) {
$str = "'" . mysql_real_escape_string($str) . "'";
//echo $str.'<br />';
}
}
return $str;
}
Example:
$xt = array("' OR ''=''",'"abcdefg"');
print_r($db->escape_str($xt));
Outputs original array, not escaped!
Can anyone help with this? Thanks.
Regarding accessing SQL query issued by any user in Oracle 10g
Hi all,
Embedding flash object in Else statement
This is my first major project in PHP and I'm having some trouble embedding a flash object in an Else statement. I've googled it several times, and looked at several sites and they all seem to
Parse error: parse error in C:wampwwwlogspagesmembers.php on line 16
I dont see the problem with this, I always get Parse error: parse error in C:\wamp\www\logs\pages\members.php on line 16, what did I do wrong?? <?php $sql = "SELECT *
how do i make new line after *
First check this page here. and you see my report. Im pulling form a mysql db. I want to beable to make a new line before each * Also why does some characters come out all funky?Hers my code.. I dont
strptime() equivalent for php4 ?!
Greetings!this is my first post, thank you in advance for your replies. Well, the title says it all, is there an equivalent of the function strptime() for php4 ? I want to parse a timestamp like this
calculator
I can't figure out why this code doesn't work. No error messages. Page loads.Code: <?php # Script 3.9 - calculator.php$page_title = 'Widget Cost Calculator';include ('./header.html');function
Character increment
Hi,I am facing a scenario like above,but in my case i want to show up like Col A,Col B etc....The container where i am displaying this is being dynamically generated using jquery.Any help?
Hashing?
Hi, I was hoping to take a string value then convert it - consistently - across each of our pages into a alphanumeric value. I figured the hash function would be able to accomplish this; the results
Show message after entering data
Hello Colleagues I would like to display messages after entering the data example: " data were successfully " or " Error send data" in advance thanks.
foreach iterator
Hi GuysDoes the foreach loop have an inbuilt iterator ?