PHP Classes

DB Connect: Query a database and fetch the result and metadata

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 37%Total: 2,088 All time: 1,873 This week: 162Up
Version License Categories
db_connect 1.0Public DomainDatabases


This is a simple class that can connect to a MySQL database, execute an SQL query and retrieve the result set rows and the respective metadata.

The class get function executes an SQL query and returns status of success of the executed query, the number of rows, the number of columns, the total number or result cells, and the list of names of the result columns as part of the result set array. The metadata result fields are prefixed with & to avoid confusion with the result column names.

Depending on the number of rows and columns contained in the result set, it may contain a two dimension array with all the data of the result columns and rows, or just an array with the data of one column or one row, or just one result value.

Picture of Cristian Rusu
Name: Cristian Rusu <contact>
Classes: 2 packages by
Country: Romania Romania
Age: 49
All time rank: 66314 in Romania Romania
Week rank: 387 Up5 in Romania Romania Up

  Files folder image Files  
File Role Description
Accessible without login Plain text file Conf. Used to specify the mySQL connection data
Plain text file db_conn.php Class Class file
Accessible without login Plain text file usage.php Example usage sample

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:1,873
This week:162Up
 User Ratings  
 All time