PHP Classes

PDO Connect and Query: Connect and query database using PDO

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 302 This week: 1All time: 7,392 This week: 571Up
Version License PHP version Categories
pdo-connect-query 1.0.0The PHP License5PHP 5, Databases
Description 

Author

This class can connect and query database using PDO.

It can connect to a database using PDO and executes SQL queries in different ways. Currently it can:

- Execute common or prepares queries and return results into arrays
- Execute queries and return the number of result rows
- Get a limited number of records from a table
- Perform inner join queries

Picture of Chike Jibunoh
Name: Chike Jibunoh <contact>
Classes: 2 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 368329 in Nigeria Nigeria
Week rank: 420 Up10 in Nigeria Nigeria Up

Example

<?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));
}


Details

myprojects


  Files folder image Files  
File Role Description
Plain text file dbclass.php Class Class source
Accessible without login Plain text file dbclassexample.php Example Example script
Accessible without login Plain text file README.md Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:302
This week:1
All time:7,392
This week:571Up