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

breaking a text file into paragraphs based on strings
I have a text file of email addresses that is all squished together. It looks like this:

abc

login form can you find my error?
registrationform.php seems fine send data to registration.php
registration.php seems fine checks

split values
I have values that are returned to me in this format:

name=>test,age=>49

How to read posted binary data from a mobile device and post it to a web server?
Here is the senario...

I have a mobile device (MD) that posts binary data to a Web Server (WS

How to make a input/output field with multiple lines
Hello.
I put a input/output field on the screen but I could not change height of it. I need to

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn ho

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

values in array being escaped
I would like to submit some values - back to the same form for checking before processing...

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

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