PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Nahid Bin Azhar   PHP JSON DB Library   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP JSON DB Library
Manage a database with data stored in JSON files
Author: By
Last change:
Date: 4 years ago
Size: 589 bytes
 

Contents

Class file image Download
<?php
require 'JsonDb.php';
use
Nahid\JsonDb;

$json=new JsonDb('erp');

// if($json->node('items')->save('monitor')){
// echo "successful";
// }

$items=[
    [
'id'=>4, 'cat'=>'pant', 'name'=>'Shirt'],
    [
'id'=>5, 'cat'=>'pant', 'name'=>'Pant'],
    [
'id'=>6, 'cat'=>'t-shirt', 'name'=>'Bra']
];
//
//if($json->node('product:code')->save("70423589")){
// echo 'Saved';
//}

//var_dump(json_decode(json_encode(reset($items))));

$data = $json->node('product:items')->where('id', '=', 4)->first();

echo
$data->cat;

// var_dump($json->node('products')->where('name', '=', 'Keyboard')->fetch());