PHP Classes

DB MySQL Prepare Statements: Query MySQL using MySQLi prepared statements

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
Not yet rated by the usersTotal: 147 All time: 9,125 This week: 455Up
Version Licenses PHP version Categories
kems_db_class 1Freely Distributable5PHP 5, Databases
Description 

Author

This class can query MySQL using MySQLi prepared statements.

It provides static functions to connect to a MySQL database and execute different types of queries using prepared statements to take parameters for composed queries.

Currently the class can execut INSERT and UPDATE queries from arrays of parameters, execute arbitrary queries (including supporting joins) using values from a variable list of function of arguments, retrieve the query results into arrays, etc..

Picture of thorr
  Performance   Level  

 

Example

<?php
DB
::Init('127.0.0.1','user','password','database'); //connect to the MySQL
DB::GetRow("select * from table where name=? and password=?",$name,$password); //accepts as many parameters as needed (one for every "?")
DB::GetAll("select * from table where field=? or field2=? or field3=?",$f1,$f2,$f2);
DB::Execute("delete from table where field=? or field2=? or field3=?",$f1,$f2,$f2);
print_r(DB::db_log());



  Files folder image Files (2)  
File Role Description
Plain text file DB.class.php Class DB 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:147
This week:0
All time:9,125
This week:455Up