PHP Classes

File: Example.php

Recommend this page to a friend!
  Classes of Peter   Simple MySQL Tool   Example.php   Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple MySQL Tool
Execute common MySQL database queries
Author: By
Last change:
Date: 10 years ago
Size: 946 bytes
 

Contents

Class file image Download
<?php
//Create
$mysql['192.168.1.10'] = new MySQL('localhost', 'root', '0000', 'mysql');
$mysql['192.168.1.10']->table('test');
$mysql['192.168.1.10']->a = 1;
$mysql['192.168.1.10']->b = 'peter';
$mysql['192.168.1.10']->c = 2;
$mysql['192.168.1.10']->d = 'joe';
$mysql['192.168.1.10']->insert();

//Read
$mysql['192.168.1.10']->table('test');
$mysql['192.168.1.10']->b = 'peter';
$mysql['192.168.1.10']->d = 'joe';
$mysql['192.168.1.10']->find();

//Update
$mysql['192.168.1.10']->table('test');
$mysql['192.168.1.10']->c = 2;
$mysql['192.168.1.10']->d = 'brian';
$mysql['192.168.1.10']->modify(array('a' => 1, 'b' => 'peter'));

//Delete
$mysql['192.168.1.10']->table('test');
$mysql['192.168.1.10']->a = 1;
$mysql['192.168.1.10']->b = 'peter';
$mysql['192.168.1.10']->delete();

//Use SQL
$mysql['192.168.1.10']->bind_param('INSERT INTO test (a, b, c, d) VALUES (?, ?, ?, ?)', array(1, 'peter', 2, 'joe'));
$mysql['192.168.1.10']->query();
?>