PHP Classes

PHP MySQL Query Builder Class: Compose and execute SQL queries on MySQL using PDO

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2021-11-28 (27 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 74 This week: 4All time: 9,855 This week: 37Up
Version License PHP version Categories
php-mysql-class 1.0The PHP License5PHP 5, Databases
Description Author

This package can compose and execute SQL queries on MySQL using PDO.

It can connect to a MySQL database using the PDO PHP extension.

The package also provides classes to compose common SQL queries from parameter values and execute them using the database connection class.

Picture of Hicri
Name: Hicri <contact>
Classes: 2 packages by
Country: Turkey Turkey

Details

PHP-MySQL-Class

Mysql Connection V1

Initialize

<?php
define('DBHost', 'localhost');
define('DBName', 'northwind');
define('DBUser', 'root');
define('DBPassword', '');
define("connection","connection");
$db = new DatabaseController(DBHost, DBName, DBUser, DBPassword,connection);

?>

Basic Table // use northwind

table "orders"

| OrderID | EmployeeID | ShipName |:-----------:|:------------:|:------------:| | 10249 | 6 | red | 10250 | 4 | yellow | 10251 | 3 | green | 10252 | 4 | yellow | 10253 | 3 | red

Insert Method (TableName, Data = array()):

TableName, Data:

$tableName = "Orders";

$data = Array
(
  "ShipName" => "Blue",
  "ShipAddress" => "Nottingham",
  "ShipCity" => "UK"
);

Insert Method
<?php
$methodInsert = $method->Insert($tableName,$data);
?>

Update Method (TableName, Id = array() , Data = array()):

TableName, Id , Data:

$tableName = "Orders";

$Id = array(
 "OrderID" => "1"
);

$data = Array
(
  "ShipName" => "Blue",
  "ShipAddress" => "Nottingham",
  "ShipCity" => "UK"
);

Update Method
<?php
$methodUpdate = $method->Update($tableName', $id, $data);
?>

Delete Method (TableName, Id = array()):

TableName, Id:

$tableName = "Orders";

$Id = array(
 "OrderID" => "1"
);

Delete Method
<?php
$methodDelete = $method->Delete($tableName,$id);
?>

Select_all Method (TableName):

TableName:

$tableName = "Orders";

Select_all Method
<?php
$methodSelectAll = $method->Select_all($tableName);
?>

Select_ch Method (TableName, Data = array()):

TableName, Data:

$tableName = "Orders";

$data = Array
(
  "ShipName", "ShipAddress", "ShipCity"
);

Select_ch Method
<?php
$methodSelectCh = $method->Select_ch($tableName,$data);
?>

Select_wh Method (TableName, Data = array(), Conn = array(), If = array()):

TableName, Data, Conn, If:

$tableName = "Orders";

$data = Array
(  
    "EmployeeID" => "4"
);

$conn = Array
(  
    "!="
);

$if = Array
(  
    "AND"
);

Select_wh Method
<?php
$methodSelectWh =  $method->Select_wh($tableName, $data, $conn, $if);
?>

  Files folder image Files  
File Role Description
Files folder imagesrc (3 files, 1 directory)
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  src  
File Role Description
Files folder imageqwerty (2 directories)
  Accessible without login Plain text file autoload.php Aux. Auxiliary script
  Accessible without login Plain text file constants.php Aux. Auxiliary script
  Accessible without login Plain text file Ext.php Example Example script

  Files folder image Files  /  src  /  qwerty  
File Role Description
Files folder imageConfig (3 files)
Files folder imageDatabase (3 files)

  Files folder image Files  /  src  /  qwerty  /  Config  
File Role Description
  Plain text file Method.php Class Class source
  Plain text file Sql.php Class Class source
  Plain text file SqlPattern.php Class Class source

  Files folder image Files  /  src  /  qwerty  /  Database  
File Role Description
  Plain text file Database.php Class Class source
  Plain text file DatabaseController.php Class Class source
  Plain text file DatabaseFace.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:74
This week:4
All time:9,855
This week:37Up
For more information send a message to info at phpclasses dot org.