I have this array that I am needing to insert into the database. My below code does not work, I end up with the same values.
array(10) { [0]=> array(1) { ["GymnastName"] => string(7) "ertwert" }
[1]=> array(1) { ["GymnastName"] => string(6) "wergfb" }
[2]=> array(1) { ["GymnastAge"] => string(8) "ewrtwert" }
[3]=> array(1) { ["GymnastAge"] => string(8) "dsfvsdtg" }
[4]=> array(1) { ["ParentsName"] => string(9) "werfgdsfv" }
[5]=> array(1) { ["ParentsName"] => string(9) "wetrgwerg" }
[6]=> array(1) { ["ParentsEmail"] => string(7) "erteqrt" }
[7]=> array(1) { ["ParentsEmail"] => string(6) "adfwer" }
[8]=> array(1) { ["ParentsPhone"] => string(7) "ertwert" }
[9]=> array(1) { ["ParentsPhone"]=> string(4) "qert" }
}
Here is my loop:
for ($i=0; $i<$l; $i++) {
$name = $gymarray[$i];
$age = $gymarray[$i];
$parentname = $gymarray[$i];
$parentemail = $gymarray[$i];
$parentphone = $gymarray[$i];
$db->insert statement here
Essentially I need to insert the records as GymnastName, GymnastAge, ParentsName, ParentsEmail, ParentsPhone.
What I end up with on the final code is:
array(1) {
["GymnastName"]=>
string(7) "ertwert"
}
array(1) {
["GymnastName"]=>
string(7) "ertwert"
}
array(1) {
["GymnastName"]=>
string(7) "ertwert"
}
array(1) {
["GymnastName"]=>
string(7) "ertwert"
}
array(1) {
["GymnastName"]=>
string(7) "ertwert"
}
$gymarray
? What is the value of$l
? What is the content of the first array, the final result ? – Luc M Jun 18 '12 at 16:45