PHP Classes
elePHPant
Icontem

File: test.mysql_query.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Niels Scheffers  >  mysql_query  >  test.mysql_query.php  >  Download  
File: test.mysql_query.php
Role: Unit test script
Content type: text/plain
Description: Testing/Example script
Class: mysql_query
Creates your mysql queries
Author: By
Last change:
Date: 12 years ago
Size: 1,151 bytes
 

Contents

Class file image Download
<?php
/*
 * ALTS - Another Little Testing Script
 * Bla bla bla... I never know what to write here...
 *
 */

include("class.mysql_query.php");
 
$my = new mysql_query("insert", "SELECT * FROM FooBar WHERE Foo = 'Bar'", "");
   
// Generate my queries from a select-statement please... Oh, and make it an insert-query... thanks.
$my->setKey("Foo1", "1"); // <-- to demonstrate the difference in handling numeric/alphanumeric values :)
$my->setKey("Foo2", "Bar2");
   
// These are the values I'd like to insert.
$my->generateQuery();
   
// Generate me a query then. C'mon, show me your power..
echo $my->query;
   
// Wow, thanks...
   
echo "<br>"; // There should be a PHP command br(); which does this :)

$my->type = "update";
   
// Let's see how you handle an update-query then?
$my->generateQuery();
   
// Hey, that's right, you already know what to do so nothing else needs to be inserted...
echo $my->query;
   
// Cool... thanks again...

echo "<br>";

$my->type = "delete";
   
// But can you do a delete?
$my->generateQuery();
   
// Guess so...
echo $my->query;
   
// Yeah yeah, I'll just take you for granted now thank you.
?>