PHP Classes

File: dbclassexample.php

Recommend this page to a friend!
  Classes of Chike Jibunoh   PDO Connect and Query   dbclassexample.php   Download  
File: dbclassexample.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PDO Connect and Query
Connect and query database using PDO
Author: By
Last change:
Date: 6 years ago
Size: 551 bytes
 

Contents

Class file image Download
<?php
//This is just an example of the usage, not really a working application
include('dbclass.php');
$db = new Db;
if(
$db){
$email = trim($_POST['email']);
$username = trim($_POST['username']);
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);

$reg = $db_conn->query("INSERT INTO example(firstname,lastname,username,password,email,date_reg) VALUES(:username,:password,:email,:privi,Now())", array(
   
'email' => $email,
   
'username' => $username,
   
'password' => $password,
   
'privi' => $privi));
}