PHP Classes
elePHPant
Icontem

PHP MySQL Database: Connect and query a MySQL database

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-06-03 (1 year ago) RSS 2.0 feedStarStar 31%Total: 380 This week: 1All time: 6,564 This week: 345Up
Version License PHP version Categories
php-simple-db-class 1.0.0GNU General Publi...5PHP 5, Databases
Description Author

This class can connect and query a MySQL database.

It parses a INI file to extract the database server host, user, password and database name to connect.

The class can perform arbitrary SQL queries and extract the query results into arrays.

The database connection is closed when the object is destroyed.

Recommendations

mysql database
script for update mysql database

Name: Waqar A <contact>
Classes: 2 packages by
Country: United Kingdom United Kingdom
Age: ???
All time rank: 3190137 in United Kingdom United Kingdom
Week rank: 179 Up5 in United Kingdom United Kingdom Up

Details

PHP-Database-Class

OOP Database class for PHP MySQL connection and insert, update, delete and select query

CONFIG File

All database configurations are stored in seperate config.ini.php file, which can be kept off document root.

DATABASE CONNECTION AND QUERIES

Database class loads configuration file and establishes a MySQLi connect in constructor so just creating an instance of class connects you with database.

e.g:

$db = new MySQLDb; // would connect to database

To run any kind of query (select, insert, update, delete), pass SQL query to query method of class

e.g:

$query = "select * from table_name";

$result = $db->query($query); //$result object returns true on successful execution

To select rows after executing query, use fetch() method and store result in an array

e.g:

$rows = $db->fetch();

Examples of Use:

examples.php has a create table SQL to create a test table and load some data in it

Examples includes quering database, checking result object and examples of select, insert, update and delete queries.

  Files folder image Files  
File Role Description
Accessible without login Plain text file config.ini.php Conf. Configuration script
Plain text file database.class.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:380
This week:1
All time:6,564
This week:345Up
User Ratings User Comments (5)
 All time
Utility:37%StarStar
Consistency:37%StarStar
Documentation:43%StarStarStar
Examples:50%StarStarStar
Tests:-
Videos:-
Overall:31%StarStar
Rank:3233