PHP Classes

PDO Prepared MySQL Statements Class: Prepare and execute MySQL queries using PDO

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 456 All time: 6,119 This week: 206Up
Version License PHP version Categories
pdo-prepared-mysql 2.0BSD License5.0PHP 5, Data types
Description 

Author

This class can prepare and execute MySQL queries using PDO.

It can connect to a given MySQL database server using PDO and execute prepared queries from parameters passed as a variable list of arguments.

The class determines the type and the length of query parameters to prepare from the type of values passed to the class.

Picture of Name Removed
  Performance   Level  
Name: Name Removed <contact>
Classes: 4 packages by
Country: ???
Age: ???
All time rank: 2025
Week rank: 195 Up

Recommendations

How to find package ?
I'd like find package for accessing MySQL database.

Example

<?php
// @ PDO Prepared MySQL Statements Class v2.0 - Example
// @ Developed by Takis Maletsas
// @ 2016
require_once 'pdo.class.php';

try {
   
   
$db = new DB;
   
$db->query("CREATE TABLE my_table ( col1 VARCHAR(255), col2 INT, col3 VARCHAR(5) )");
   
$db->query("INSERT INTO my_table (col1,col2,col3) VALUES (?,?,?)", "Value1", 123, true);
   
   
$rows = $db->fetch("SELECT * FROM my_table WHERE col1=?", "Value1");
    echo
$rows[0]['col2'] . "</br>";
   
var_dump($rows[0]);
   
var_dump($rows);
   
   
$rows = $db->fetch("SELECT * FROM my_table WHERE col2=? AND col3=?", 123, true);
    echo
$rows[0]['col1'] . "</br>";
   
var_dump($rows[0]);
   
var_dump($rows);
   
   
$db->query("UPDATE my_table SET col1=?, col3=? WHERE col2=?", "Value2", true, 123);
   
   
$rows = $db->fetch("SELECT * FROM my_table");
    echo
$rows[0]['col1'] . "</br>";
   
var_dump($rows[0]);
   
var_dump($rows);
   
}
catch (
Exception $e) {
   
    exit(
$e->getMessage());
   
}
?>


  Files folder image Files (2)  
File Role Description
Plain text file pdo.class.php Class Class
Accessible without login Plain text file example.php Example Example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:456
This week:0
All time:6,119
This week:206Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:294
 
Thats a very good class ;-)
8 years ago (José Filipe Lopes Santos)
70%StarStarStarStar