Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.
This repository was archived by the owner on Jan 10, 2022. It is now read-only.

class returns table as an array but fails to save one #6

@codeofsumit

Description

@codeofsumit

I'm a PHP beginner and this is something I really don't understand.

JSON

[]

PHP

$items = new JsonTable("../itemDB.json");

$currentItems = $items -> selectAll();

$items -> updateAll($currentItems);

$result = $items -> selectAll();

echo $result

Do that 5 times and you get

[[[[[]]]]]

why? What do I have to do with the array from selectAll() so it can get saved again without the weird nesting?

If I understand this correctly, selectAll gets the complete table while updateAll updates the contents of the table. What are my options here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions