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

php/xmlrpc class issue
I am working on xml-rpc in php to start with.

I have a class that only has variables defined

Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.

So I have a bas

ALV List Display to point to another report on Double Click
Hi,

I want my ALV List Display to point to another report on Double Click on its line ite

Click counter to ignore traffic from search bots
I have a click counter on my site that...well, counts the number of clicks a link gets on the frontp

Delete all files in folder except with certain name
I have a script that I want to delete all files in a folder (taken from a database) except for one n

Having Problem with Date
l have a submit buttom where user have the possibility to add a date to specify when his message s

Amatuer requiring assistance
Beginner and amateur in need of assistance

My Site - (Spare Parts for Domestic Appliances)

need help in php variable
i have a php variable on one page
Code: [Select]$lastId = mysql_insert_id($db);
echo $lastId;<

eregi to preg
Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi(&q

help with database debug pls
Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/chec

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