Recommend this page to a friend! |
Download .zip |
Info | View files (2) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2014-09-22 (2 years ago) | Not enough user ratings | Total: 534 | All time: 5,337 This week: 1,068 |
Version | License | PHP version | Categories | |||
pdo-database-wrapper 1.3 | GNU General Publi... | 5.0 | PHP 5, Databases |
Description | Author | |||||||||||||
This class is a database access wrapper using PDO. It can: |
|
/************************************************************************/ /* My Database Connection /* http:// /* Copyright © 2010 by Julio Alvarado /************************************************************************/ /* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ How to connect: $DATABASE = array( "dsn" => "mysql:host=localhost;port=3306;dbname=mydb", "username" => "root", "password" => "password" ); $db = new db($DATABASE); if($db->connect()) { //Do Somthing }else{ die($db->error()); } Select, Insert, Update and delete Data: $data = $db->exec($sqlselectstatement, $fetchtype , $fetchstyle, $bindings); A: Sql statements: (required) "Select * from Mydb" "INSERT Mydb (name, status, description) VALUES (:name, :status, :description)"; "UPDATE Mydb SET name = :name, status = :status, description = :description WHERE id = :id"; "DELETE FROM Mydb WHERE id = :id"; B: Fetch Types: (optional) A: fetch B: fetchAll C: fetchColumn D: fetchObject C: Fetch Style: PDO::FETCH_ASSOC PDO::FETCH_BOTH (default) PDO::FETCH_BOUND PDO::FETCH_INTO PDO::FETCH_LAZY PDO::FETCH_NAMED PDO::FETCH_NUM PDO::FETCH_OBJ D: Bindings: (depending on statement) $bindings = array("name" => $name, "status" => $status, "description" => $description, "id" => $id); you can run diectly to execution(for no response back) only errors $data = $db->execution($sqlselectstatement, $bindings); other functions Rowcount: (gets row count for selection) $mycount = $db->rowcount($sql->Select); ColCount: (gets column count for selection) $mycount = $db->colcount($sql->Select); Close: (Closes Connection) $db->Close(); Error:(error catching) $db->error(); |
pdo-database-wrapper-2014-09-22.zip 2KB | |
pdo-database-wrapper-2014-09-22.tar.gz 1KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.