PHP code example of andela-aonyango / potato-orm
1. Go to this page and download the library: Download andela-aonyango/potato-orm 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/ */
andela-aonyango / potato-orm example snippets
php
// Example usage of this ORM
= new Person();
$person->first_name = "yua";
$person->last_name = "madha";
$person->age = 73;
// the add() method inserts an object and returns the last inserted id
$id = $person->add();
// retrieve the just-added person
$test = $person->find($id);
print_r($test);
$test->gender = "female";
$test->update();
// is the update successful
print_r($test->find($id));
// delete the person from the database
$test->remove();
// retrieve all people
print_r($person->findAll());