I am new to database and php and not sure how to do the following. I am using wampserver which comes with mysql.
I am receiving a json data which i used json_decode to get a php 3-level array. Now how do i insert these data into a database and also display it in a table form?
I searched and there are quite a number of examples on insertion portion. But must I create a database with all the fields first before insertion? How to retrieve and display it after insertion?
Sample of the array to be inserted is as shown in another posting:
insert from array has multi levels to database using php
I think you should serialize the data and store it in a single column.
Use PHP
serializefunction.Now store
$stringin a text field in DB. You dont need to create different fields for different variables.To retrieve the data from database, you should unserialize the string as:
This approach will allow you to save as many variables in DB as you want without need to create separate fields for each variable.