PHP foreach help
Posted
by sea_1987
on Stack Overflow
See other posts from Stack Overflow
or by sea_1987
Published on 2010-06-17T07:54:29Z
Indexed on
2010/06/17
8:03 UTC
Read the original article
Hit count: 157
Hello I have an array that looks like this,
Array
(
[cfi_title] => Mr
[cfi_firstname] => Firstname
[cfi_surname] => Lastname
[cfi_email] => [email protected]
[cfi_subscribe_promotional] =>
[cfi_tnc] =>
[friendsName] => Array
(
[0] => Firstname 1
[1] => Firstname 2
[2] => Firstname 3
)
[friendsEmail] => Array
(
[0] => [email protected]
[1] => [email protected]
[2] => [email protected]
)
[submit_form] => Submit
)
My dilema is I need to save the values from the friendsName and friendsEmail arrays into a database, I know I can loop through them but how can I send the matching data, for example I need to save [friendsName][0]
and friendsEmail][0]
on the same row of database?
I know I need to use a foreach but I just cannot figure out the logic.
© Stack Overflow or respective owner