PHP Classes

File: testdb.php

Recommend this page to a friend!
  Classes of ZAY   MySQL API   testdb.php   Download  
File: testdb.php
Role: Example script
Content type: text/plain
Description: Test file for API
Class: MySQL API
MySQL database access wrapper
Author: By
Last change: Clearing some testing code that no longer be used
Date: 13 years ago
Size: 1,424 bytes
 

Contents

Class file image Download
<?php
 
include_once("./api/Database.php");

 
$connection = Database::dbConnection
     
(
       
"127.0.0.1",
       
"username",
       
"password",
       
"schema_name"
     
);
 
 
$table = "user_ip_addr";
 
 
$columnList =
      array(
        array(
'column'=>"ip_addr"),
        array(
'name'=>"new", 'column'=>'ip_addr', 'calc'=>"MAX")
      );
 
 
$conditionList =
      array(
        array(
'column'=>"id", 'operator'=>" > ", 'value'=>"999", 'linking'=>""),
        array(
'value'=>"1", 'linking'=>"AND")
      );
     
 
$groupList = array('ip_addr');
 
 
$orderList = array('ip_addr');
 
 
$limit =
    array(
      array(
'min'=>"1", 'max'=>"100")
    );

 
Database::selectData($connection, $table, $columnList, $conditionList, $groupList, $orderList, $limit);
 
 
$columnList = null;
 
 
$dataList =
      array(
       
"null", "192.168.0.1", "0"
     
);

 
Database::insertData($connection, $table, $columnList, $dataList);

 
$id = Database::mysql_insert_id($connection);
 
 
$columnList = array("status");
 
 
$dataList = array("1");
 
 
$conditionList =
    array(
      array(
'column'=>"id", 'operator'=>"=", 'value'=>$id, 'linking'=>"")
    );

 
Database::updateData($connection, $table, $columnList, $dataList, $conditionList, $limit);
 
 
$limit = "1";

 
Database::deleteData($connection, $table, $conditionList, $limit);
?>