PHP code example of crojasaragonez / utn-db

1. Go to this page and download the library: Download crojasaragonez/utn-db 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/ */

    

crojasaragonez / utn-db example snippets

 php
e crojasaragonez\UtnDb\PgConnection;

$con = new PgConnection('postgres', '12345', 'pmo', 5432, 'localhost');
$con->connect();
$sql = "INSERT INTO projects(name, description, start_date, end_date) VALUES ($1, $2, $3, $4)";
$con->runStatement($sql, ['Project 1', 'project description', '2020-01-01', '2020-01-02']);

$results = $con->runQuery('SELECT * FROM projects WHERE id >= $1', [1]);

var_dump($results);

$con->disconnect();