Forums

problem: only saves the last record in the database

Fredolino 14 Oct, 2020
Hello,

i want to save data to the database and i have a save_data function.
The data is displayed in the debugger under "save_data_species".
But it only saves the last record in the database for me.
Can someone tell me where the problem is?

regards
F.
[save_data_species] => Array
        (
            [data] => Array
                (
                    [0] => Array
                        (
                            [MTB_Art] => Array
                                (
                                    [beo_art_id] => 2319
                                    [count_species] => 1
                                    [beof_id] => 1262
                                )

                            [MTB_Fundort] => Array
                                (
                                    [mtb_id] => 2752
                                )

                        )

                    [1] => Array
                        (
                            [MTB_Art] => Array
                                (
                                    [beo_art_id] => 1947
                                    [count_species] => 4
                                    [beof_id] => 1230
                                )

                            [MTB_Fundort] => Array
                                (
                                    [mtb_id] => 3245
                                )

                        )

                    [2] => Array
                        (
                            [MTB_Art] => Array
                                (
                                    [beo_art_id] => 2321
                                    [count_species] => 1
                                    [beof_id] => 1265
                                )

                            [MTB_Fundort] => Array
                                (
                                    [mtb_id] => 3246
                                )

                        )

                    [3] => Array
                        (
                            [MTB_Art] => Array
                                (
                                    [beo_art_id] => 1955
                                    [count_species] => 1
                                    [beof_id] => 1238
                                )

                            [MTB_Fundort] => Array
                                (
                                    [mtb_id] => 5243
                                )

                        )

                    [TKnr] => 5243
                    [Species] => 1
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `mtb_map_germany` (`TKnr`, `Species`)  values  ('5243', '1') ON DUPLICATE KEY UPDATE `TKnr` = '5243',`Species` = '1';
                )

            [var] => Array
                (
                    [TKnr] => 5243
                    [Species] => 1
                    [id] => 
                )

        )

)
Max_admin 23 Oct, 2020
Answer
The data source for the "Save data" is not formatted correctly, you have TKnr and Species fields, then you have an array of arrays, so it saves the fields and ignores the arrays, what do you expect to save exactly ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Fredolino 23 Oct, 2020
1 Likes
Hi,

yes, the Array-Problem is solved. :-)

Thanx
F.
You need to login to be able to post a reply.