PHP code example of solve / database

1. Go to this page and download the library: Download solve/database library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

solve / database example snippets


$product = Product::loadOne(1);
$product->title = 'Macbook air';
$product->save();

$product = new Product();
$product->title = 'Macbook pro'
$product->save();

$list = Product::loadList(QC::create()->where('id < :d', 3));
//$list->loadRelated('brand'); - optional
echo $list->getFirst()->brand->id;
$list->getFirst()->setRelatedBrand(1); // set related by id