PHP Classes

File: Exemplo/WorkData.php

Recommend this page to a friend!
  Classes of Maicon gonšalez  >  PHP JSON DB Class  >  Exemplo/WorkData.php  >  Download  
File: Exemplo/WorkData.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP JSON DB Class
Manipulate JSON data as database tables
Author: By
Last change: Update Erros Relational Models
Date: 7 years ago
Size: 1,988 bytes
 

Contents

Class file image Download
<?php
require_once("_Setup.php");
//After creating your model, you can insert, read, update, and remove data
//Model User Generate On File "GenerateModel.php"

# View Full Documentation On http://jsondb.inclouds.com.br/

# Insert Data - http://jsondb.inclouds.com.br/index.php/Page/inserir-dados
# Validation Values - http://jsondb.inclouds.com.br/index.php/Page/validacao
# Search Data - http://jsondb.inclouds.com.br/index.php/Page/buscar-dados
# Order Data - http://jsondb.inclouds.com.br/index.php/Page/ordenar-dados
# Update Data - http://jsondb.inclouds.com.br/index.php/Page/alterar-dados
# Remove Data - http://jsondb.inclouds.com.br/index.php/Page/remover-dados
# Others - http://jsondb.inclouds.com.br/index.php/Page/outras-funcoes

//Insert New Data
   
$User = new ModelJdb_User();
   
$User->Nome = "Felipe";
   
$User->Sobrenome = "Smith";
   
$User->Nascimento = "18/10/1995";
   
$User->Sexo = "f";
   
$User->Email = "felipesmith@exemplo.com.br";
   
$User->Password = sha1("123456");
   
$User->save();
   
   
// Check Errors
   
$Errors = $User->getErrors();
    if (
is_array($Errors)){
       
print_r($Errors);
    }
   
//Inser New Data With Relative Model
   
$User = new ModelJdb_Users();
   
$User->getRelative("Adress");

   
$User->Nome = "Felipe";
   
$User->Sobrenome = "Smith";
   
$User->Nascimento = "18/10/1995";
   
$User->Sexo = "m";
   
$User->Email = "felipesmith@exemplo.com.br";
   
$User->Password = sha1("123456");
       
$User->_Adress['Adress'] = "16?18?";
       
$User->_Adress['City'] = "QD 34 LT 10";
       
$User->_Adress['State'] = "Seu Pai";
       
$User->_Adress['Country'] = "Meu Brašo";
       
$User->_Adress['ZipCode'] = "Quebrou";
   
$User->save();

// Verifica Erros
$Errors = $User->getErrors();
if (
is_array($Errors)){
   
print_r($Errors);
}
   
//Update Data
   
$Model = new ModelJdb_User();
   
$Model->findOneByNome("Felipe");
   
$Model->Nome = "Felipe Da Silva";
   
$Model->save();
   
//Remove Data
   
$Model = new ModelJdb_User();
   
$Model->findOneByNome("Felipe");
    if (
$Model instanceof ModelJdb_Users){
       
$Model->remove(false);
    }