Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 236 | | All time: 8,084 This week: 455 |
|
Description | | Author |
This class can compose and execute MySQL queries using PDO.
It can establish a connection to a MySQL database server using the PDO extension.
The class can also compose and execute SQL queries of several types using given parameters, like SELECT, INSERT, UPDATE and DELETE.
| |
 |
|
Innovation award
 Nominee: 6x |
|
Example
<?php
require_once 'classes/MYSQL.php';
$mysql = new MYSQL('localhost', 'root', '');
/* Creating tables */
//$mysql->CreateDb("PHP");
/* deleting database */
//$mysql->DeleteDb("PHP");
/* creating table */
/*$mysql->CreateTbl("PHP","CREATE TABLE users(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(30) NOT NULL,
last_name VARCHAR(30) NOT NULL,
email VARCHAR(70) NOT NULL UNIQUE
)");*/
/* deleting table */
//$mysql->DeleteTbl("PHP","users");
/* inserting records */
//$id = $mysql->Insert('users','PHP',['first_name'=>'Malik Uner','last_name'=> 'Farooq','email'=> 'lablnet01@gmail.com']);
/* updating database */
//$id = 1;
//$mysql->Update(['table'=>'users','db_name'=>'PHP','columns'=>['first_name' => 'Malik Umer'],'wheres'=>['id ='. 1]]);
/* selecting values */
$result = $mysql->Select(['table'=>'users', 'db_name'=>'PHP', 'wheres'=>['email ='.$mysql->Quote('lablnet01@gmail.com')]]);
print_r($result);
/* deleting the records */
//$mysql->Delete(['table'=>'users','db_name'=>'PHP','wheres'=>['id ='. 9]]);
/* Counting the records */
//echo $mysql->Count(['table'=>'users','db_name'=>'PHP','wheres'=>['id ='. 9]]);
//Close the connection its recommended to clsoe connection
$mysql->Close();
|
Details
PHP MYSQL Manipulation Class
PHP MYSQL Manipulation Class
Feature
- Create database.
- Delete database.
- Create table.
- Delete table.
- Insert into table.
- Update record in table.
- Select data form table (Joins
,Limits
,OrderBy
,Wheres
debug
).
- Delete record in table.
- Count record in table.
- Quote string.
- Provide method for close database connection
Simple example
<?php
//loading require file.
require_once 'classes/MYSQL.php';
open connection.
$mysql = new MYSQL("host","user",'pass');
//slecting records.
$result = $mysql->Select(['table'=>'table_name','db_name'=>'db_name']);
//closing connection.
$mysql->Close();
to-do
- Updating tables
- Creating table in efficient ways
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.