| 
<?
// some examples....
 require_once("init.inc.php");
 // create a new sql object
 $sql = new MySql("dbhost","dbuser","dbpass",true);
 // get some info on mysql server
 $server_info = $sql->getServerInfo();
 // create a database and receive databaseObj
 $dbObject = $sql->createDB('testDatabase');
 // and get a list of databases
 $result = $sql->listDBs();
 while ($row = mysql_fetch_row($result)) {
 print "Database: $row[0]<br>\n";
 }
 print "------------------------------------------<br>\n";
 // drop this newly created table
 $dbObject->drop();
 // and get a list of databases
 $result = $sql->listDBs();
 while ($row = mysql_fetch_row($result)) {
 print "Database: $row[0]<br>\n";
 }
 print "------------------------------------------<br>\n";
 // select a database
 $dbObject = $sql->selectDB("anotherDB");
 // and get a list of tables in this DB
 $result = $dbObject->listTables();
 while ($row = mysql_fetch_row($result)) {
 print "Table in ".$dbObject->getName().": $row[0]<br>\n";
 }
 print "------------------------------------------<br>\n";
 //    and create a table object linked to this DB table
 $tableObj = $dbObject->selectTable("someTable");
 // turn debug messages for queries to this table on
 $tableObj->debug= true;
 // insert a value
 $result = $tableObj->insert("someColumn","'someString'");
 // get some meta infos
 print "AffectedRows:".$tableObj->getAffectedRows()."<br>\n";
 // get all data in this table
 $result = $tableObj->select("*");
 // and print out number of hits
 print "NumRows:".$tableObj->getNumRows()."<br>\n";
 ?>
 |