iterating through an array and escape each value independently.


Posted on 16th Feb 2014 07:03 pm by admin

I have a set up where the variable being escaped is an array and it needs to be iterated and escaped by separate. I need some help.

Code: <?php

$arrFoodTypes = isset($_REQUEST['frmSearch']['food_types'])?mysql_real_escape_string($_REQUEST['frmSearch']['food_types']):array();
?>
How can I fit that if else statment inside the below foreach loop. the indexes has been a difficult to place them

Code: <?php
foreach($_REQUEST as ['frmSearch]=>'['food_types'])
{$data['frmSearch']=mysql_real_escape_string(['food_types]);}
?>

Is this correctly syntaxed it? if any syntax error or mistake please correct me. Is iteration possible with the above set up at the foreach loop?

No comments posted yet

Your Answer:

Login to answer
104 Like 40 Dislike
Previous forums Next forums
Other forums

trouble printing an array....
I'm having some trouble printing out an array forwards. I'm figuring out the high and low of an arra

tag inside php...
hi


Code: <?php
echo "<td width="$columnWidth%" align=&

Timer control causing error
I recently decided to add a timer control to an existing page that uses AJAX on my site. As soon as

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

filesize() returns 0
I have a socket program that runs in an infinite loop, listening for connections, in this socket I h

PHP webpage & array print issue
I have this code running, and it works perfectly … however, see my bottom bit about what I see

EXplanation help
Hey all,

I am still fairly new to PHP programming and I am trying to put together a page wher

Limiting uploaded file type
Hi. First post here
I am working on a simple upload script, and I need it to limit the allowed f

displaying email without attracting a ton of spam
Hello,

this is maybe the wrong place to ask.
How would you display an email address on a w

question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.

I hav

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash