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

Did you know?Explore Trending and Topic pages for more stories like this.
$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

Using the $_GET variable to view certain records
Hello,

First let me explain my problem, I have 2 pages the first page pull a list of Guide ti

How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But

PHP Surveys
I really would like some advice.

If you have a client come to you asking for a survey to be d

reading partial code from external site
Hi,

I am trying to write a script for my website to get an article from an external website.

natcasesort works on one server but not on another
Hi

I have a problem that I was hoping that someone can help me with.

I'm trying to use

Date/Time and Checkbox
Hi Everyone,

I am trying to figure out how to insert the current date and tim

News script
Hi ...

I am not sure if this is the rite place to post this but if its not sorry

i am

Price in PR
Dear Experts,
Why we have to enter the price in the PR, and why there is no free goods indicato

Bandwidth monitoring?
Hi guys,

I need a little information I have written a php app and I occurred to that I need

Extracting Long text from message class with parameters
Hi,

I would like to extract the long text from a message class. However, the long text ha

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