/    Sign up×
Community /Pin to ProfileBookmark

I have a table on my page tht has four columns as shown below and the data from tht has been entered in the four rows.

now I need add data to the databse so i need to group the data using the “foreach” loop for all the index[0] then [1] and similarly for each row.

Can some one help me with tht

[Name] => Array
(
[0] => I1
[1] => I2
[2] => I3
[3] => I4
)

[Index] => Array
(
[0] => P1
[1] => P2
[2] => P3
[3] => P4
)

[Index2] => Array
(
[0] => SBB1
[1] => SBB2
[2] => SBB3
[3] => SBB4
)

[Connect] => Array
(
[0] => 0
[1] => 1
[2] => 5
[3] => 0
)

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@Shanu_chaudharyJun 09.2010 — Could you plz send the screenshot of your page and some of the code you are using???
Copy linkTweet thisAlerts:
@hcl_techauthorJun 09.2010 — it isn possible to put the screenshoots as well not well versed with the foreach loop looking for support to start...........

thts the output tht i need to club...

Thanks
Copy linkTweet thisAlerts:
@NogDogJun 09.2010 — Not sure I understand, but if you want to reorganize the array so that the 2nd dimension indexes become the 1st dimension and vice versa, you could do something like:
[code=php]
$newArray = array();
foreach($oldArray as $key => $arr)
{
foreach($arr as $ix => $value)
{
$newArray[$ix][$key] = $value;
}
}
[/code]

Then you could do a foreach() on the $newArray for your DB insert.
×

Success!

Help @hcl_tech spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...