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

Product categories for registration
Dear all,

We are going live with the Supplier registered next week. At standard, the 'sel

License Issue - service type user
Hi,

I would like to understand the following issue regarding sap license.
I wish to

selection tool on raster image
Hi!
I have to implement in my app a selection tool which lets users to select region of any shape

query help
Hi experts.

i have a table rep2 like this
PROD_COD ACCT_NO DUE_DAYS BALANCE

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

How to form a xml form table with a single sql statement..?
Hi everyone,
I don't know if this is going to be a duplicate thread but i couldn't

Renaming array keys
The issue: renaming array keys inside a foreach loop.

I'm trying to build a pie chart image w

Request.UrlReferrer
I need to make it so that a page can only be loaded when a button is clicked on a specific page. I d

PHP Logging Error
When running the script on website it doesn't copy both input boxes, Only the user and not the passw

Delete all from a table
I can not get the following code to work. If I run the sql statement in the db it will delete all t

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