Javascript: I have about ten objects. I need to store them in database (MySQL).
MyObject.create({
id: 1,
name: "object_1",
...
buttons: [
{
name: "OK",
action: "Accept"
},
{
name: "No",
action: "Cancel"
}
]
});
The database consists of: object table and objects-settings table. Now result is the next:
| obj_id | prop | type | value |
| 1 | id | int | 1 |
| 1 | name | str | object_1 |
...
| 2 | id | int | 2 |
| 2 | name | str | object_2 |
But i need to store hierarhy data in database. It looks like hierarhy menu or json. I don't want to use recursive functions on php. I have found this link, but can't understand it.
I it will be a table like (id, item, parent), how to build a sql query.