PHP Classes

File: example/index.php

Recommend this page to a friend!
  Classes of Leonardo Mauro Pereira Moraes   Connection DBMS   example/index.php   Download  
File: example/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Connection DBMS
Connect to databases using PDO or MySQLi
Author: By
Last change: Update of example/index.php
Date: 1 year ago
Size: 715 bytes
 

Contents

Class file image Download
<?php

/* Autoload Include */
require('../dist/php/autoload.php');

use \
Connection\MysqliInstruction;
use \
Connection\PDOInstruction;

/**
* Example: Litle example to show some methods
*/

/* Example (MYSQLI_instruction) */

$mysqli = new MysqliInstruction();
$mysqli->connect();
$resp = $mysqli->select('SELECT * FROM table WHERE id < ?', array('10'));
$resp = $mysqli->generic('DELETE FROM table WHERE id = ?', array('2'));
var_dump($resp);
$mysqli->end();


/* Example (PDO_instruction) */

$pdo = new PDOInstruction();
$pdo->connect();
$resp = $pdo->select('SELECT * FROM table WHERE id < ?', array('10'));
$resp = $pdo->generic('DELETE FROM table WHERE id = ?', array('2'));
var_dump($resp);
$pdo->end();

?>