| 
<?php
 /**
 *    $RCSfile: example.php,v $
 *    @author     $Author: Cornelius Bolten $
 *    @version    $Revision: 1.2 $
 *
 *
 *    @description:
 *        - this is the example-file for mysqlQueryContainer by
 *          Cornelius Bolten
 *
 *    so now..here we go!
 *
 **/
 
 require_once("mysqlQuery.inc.php");
 
 /**
 *    create MySQL-Container named "connection1" and another one
 *    named "connection2"
 */
 $myContainer    =    new mysqlquery("pconnect");
 if(!$myContainer->addNewConnection("connection1","host1","databaseY","user","password",3306))
 echo("error: ".$myContainer->containerError);
 if(!$myContainer->addNewConnection("connection2","host2","databaseX","otheruser","otherpassword"))
 echo("error: ".$myContainer->containerError);
 
 /**
 *    open both database-connections
 */
 if(!$myContainer->openConnection("connection1"))
 echo("error: ".$myContainer->containerError);
 if(!$myContainer->openConnection("connection2"))
 echo("error: ".$myContainer->containerError);
 
 /**
 *    execute an SELECT statement on connection 1
 */
 if(!$myData = $myContainer->executeSelect("connection1","SELECT * FROM `Table1` LIMIT 0, 30")) {
 echo("error: ".$myContainer->sqlError);
 } else {
 echo "<bR>query executed correct";
 }
 
 /**
 *    and another execute on connection 2
 */
 if(!$myData = $myContainer->executeSelect("connection2","SELECT * FROM `Table1` LIMIT 0, 30")) {
 echo("error: ".$myContainer->sqlError);
 } else {
 echo "<br>query executed correct";
 }
 
 /**
 *    finally close both connections and flush container.
 */
 $myContainer->closeConnection("connection1");
 $myContainer->closeConnection("connection2");
 $myContainer->flushConnectionContainer();
 ?>
 |