PHP code example of zedan / database-package

1. Go to this page and download the library: Download zedan/database-package 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/ */

    

zedan / database-package example snippets



use Zedan\DatabasePackage\DbWrapper;
$db = new DbWrapper();

/* connect to database */
$db = new DbWrapper('localhost', 'username', 'password', 'database', 3306);


/* insert/update/delete */
$id = $db->insert('tablename', ['col1' => 'foo'])->execute();
$db->update('tablename', ['col1' => 'bar'])->where('id','=',$id)->execute();
$db->delete('tablename')->where('id','=',$id)->execute();
$db->select('tablename',$cols|)->where()->getRow();
$db->select('tablename',$cols|)->getAll()
$db->select('tablename',$cols|)->where()->andWhere()->getRow();
$db->select('tablename',$cols|)->where()->orWhere()->getRow();