Buy Now
Sign in

Need a Quick reminder - how can i safe an array of arrays with save fn?

Proximate , August 15 2019, 19:26
P
Proximate 122
August 15 2019, 19:26 #388849
Hi together - i need a quick reminder - i am not able to see how i can save my array of arrays into the database:
Structure (var)
[read_csv_data] => Array
(
[var] => Array
(
[0] => Array
(
[catId] => 11
[endPlace] => 1
[starter] => 102
[teamname] => MS4ever
[p1_firstname] => Claudio
[p1_lastname] => Brändli
[p2_firstname] => Tobias
[p2_lastname] => Widmer
[sa_time] => 06:59:56
[sa_place] => 1
[so_time] => 08:07:37
[so_place] => 1
[tot_time] => 15:07:33
[tot_place] =>
)

[1] => Array
(
[catId] => 11
[endPlace] => 2
[starter] => 113
[teamname] => OL Regio Olten tärkeintä on pi
[p1_firstname] => Christoph
[p1_lastname] => Hümbelin
[p2_firstname] => David
[p2_lastname] => Von Arx
[sa_time] => 08:04:03
[sa_place] => 3
[so_time] => 09:12:06
[so_place] => 2
[tot_time] => 17:16:09
[tot_place] =>
)....
Target is to add each array into the db table - the table cols has the same name (catId, endPlace, starter...) like the each array.
isnt the save fn able to save each array into a new row?
and how to assign the col names to the var.arr.arr.identificator?
my save fn so far but yes its not working:

will the function reconise that the data provider is an array?
thanks for your help
P
Proximate 122
August 15 2019, 19:59 #388850
 1
nevermind i found the solution:
the save fn must be called inside the loop fn and
the fieldvalues can be get by {var:loopfunctionname.row.fieldname}