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 call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d

Echoing If Function?
A script I am using has If statements in the comments form to basically tell the form what to do. Cu

Accessing Infotype data in dialog program
Hi All
In Dialog programs attributes I didn't see any logical database field. How can I access

form problem
Hi all, I think this is going to be easy to resolve but for I have been looking at it to long and I

Adding meta tags under Zend FW
Hello there, recently has come to my hands the FTP of a website which is running under Zend, I would

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

Simple program to copy files between two computers over the web
I use logmein free and often need to move files between my two computers. Generally, I move the file

How to give the privillege for triggers?
Hi,

How to give the privillage for triggers to particular user?

Please let me

PHP doesn't send my mail
Hi all, I found this and used it to send mail. Simple contact form with some required fields. The va

iMatch stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

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