A
A
Artem2015-06-09 12:29:37
PHP
Artem, 2015-06-09 12:29:37

How to work big json and mysql?

according to the API of a certain service, I get a large JSON with the same structure inside.
For example, I show one of the 1900 records in this JSON (though I will show it in the form of an array) The
question is that I need to upload this to the mysql database for further work with this data, and in particular, through the filter (html + js) output using AJAX to the user and periodically it is planned to update the data via Cron.
Please advise how this can be better implemented! As I understand it, it's better to use related tables here! but to be honest, I didn’t work with them and I don’t fully understand how to insert and select data (also delete and update)! Thank you in advance for your mind and time =)

[309266] => Array
        (
            [server_id] => 309266
            [cfg_type] => print_configurator_p_1
            [cpu] => VPS OpenVZ 1 CPU Cores
            [ram] => 256 Mb RAM
            [hdd] => Array
                (
                    [0] => Array
                        (
                            [name] => 10 Gb SAS
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [traffic] => Unlimited
            [location] => Array
                (
                    [0] => Array
                        (
                            [name] => Russia
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [dc] => 
            [net_test] => 
            [uplink] => 1 Gbit/s port shared
            [ram_up] => Array
                (
                    [0] => Array
                        (
                            [name] => 256 Mb RAM
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [hdd_1] => Array
                (
                    [0] => Array
                        (
                            [name] => 10 Gb SAS
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )

                )
            [hdd_2] => Array
                (
                    [0] => Array
                        (
                            [name] => None
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [hdd_3] => Array
                (
                    [0] => Array
                        (
                            [name] => None
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )

                )
            [hdd_4] => Array
                (
                    [0] => Array
                        (
                            [name] => None
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [os] => Array
                (
                    [0] => Array
                        (
                            [name] => Debian
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                    [1] => Array
                        (
                            [name] => Centos
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                    [2] => Array
                        (
                            [name] => Ubuntu
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [c_panel] => Array
                (
                    [0] => Array
                        (
                            [name] => None
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [ip_address] => Array
                (
                    [0] => Array
                        (
                            [name] => 1
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [ip_v6_addr] => Array
                (
                    [0] => Array
                        (
                            [name] => None
                            [month_price] => 0.00
                            [setup_price] => 0.00
                        )
                )
            [traffic_up] => Array
                (
                )
            [len] => Array
                (
                    [0] => Array
                        (
                            [len] => 3
                            [procent] => 0
                        )
                    [1] => Array
                        (
                            [len] => 6
                            [procent] => 0
                        )
                    [2] => Array
                        (
                            [len] => 12
                            [procent] => 0
                        )
                )
            [month_price] => 4.00
            [setup_price] => 0.00
        )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evnuh, 2015-06-09
@Artso

The solution is obvious - you need to understand how to work with related tables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question