PHP code example of previewtechs / simple-pdo

1. Go to this page and download the library: Download previewtechs/simple-pdo 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/ */

    

previewtechs / simple-pdo example snippets



 = new \Previewtechs\Database\MySQL\PDO(MYSQL_DSN, MYSQL_USERNAME, MYSQL_PASSWORD);

$pdo->query("INSERT INTO users (id, name, email, created) VALUES (NULL , :name, :email, :created)");

$pdo->bind(':name', "Your Name");
$pdo->bind(':email', "[email protected]");
$pdo->bind(':created', date("Y-m-d H:i:s"));

$pdo->execute();

echo $pdo->lastInsertedId();    //should return ID from database