PHP code example of adrian0350 / simple-pdo-wrapper
1. Go to this page and download the library: Download adrian0350/simple-pdo-wrapper 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/ */
// For now conditions only has basic clause.
$options = array(
'conditions' => array(
'username' => '[email protected]'
),
'limit' => 10,
'fields' => array('id', 'username', 'password', 'name'),
'order' => array('id DESC')
);
// When updating it will only return true or false.
$update = array(
'name' => 'Adrián Zúñiga'
);
$SimplePDOWrapper->update('users', $update, array(
'conditions' => array(
'id' => $user_saved['id']
)
));
// This findOne will return the one entity array or empty array.
$user = $SimplePDOWrapper->findOne('users', $options, $assoc = true);
// And findAll will return empty array or an array of STDClass objects.
$users = $SimplePDOWrapper->findAll('users', $options, $assoc = false);