PHP Classes
elePHPant
Icontem

File: metatest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Fred Benson  >  Meta Scanner  >  metatest.php  >  Download  
File: metatest.php
Role: Example script
Content type: text/plain
Description: sample php file
Class: Meta Scanner
Retrieve and show structure metadata from MySQL
Author: By
Last change:
Date: 10 years ago
Size: 2,700 bytes
 

Contents

Class file image Download
<?
/************************************************************************/
/* METASCANNER SAMPLE */
/************************************************************************/

include ("metascanner.php"); //Importing Class file

$metadata = new MetaScanner("localhost"); //Instantiating class MetaScanner with server specification as a parameter
$metadata->connect(); //Connects too the specified DataBase


/************************************************************************/
/*SAMPLE 1: SHOWS ALL MYSQL SERVER DATABASES AND RELATIVE INFORMATION */
/************************************************************************/

$metadata->showAll(); //Shows all MySql server in a simple table style


/************************************************************************/
/*SAMPLE 2: SCAN THE ALL SERVER */
/************************************************************************/

$metadata->scanAll();


/************************************************************************/
/*SAMPLE 3: PRINT ALL FIELDS OF A DETERMINED TABLE */
/************************************************************************/
/*Put a tabel name before uncomment those lines */
/************************************************************************/

/*$tempvalue = $metadata->returnfllist();
for($i=0;$i<mysql_num_fields($tempvalue["put_your_table_name_here"]);$i++)
                    {
                    print("<tr>
                    <td width=\"33%\" align=\"center\">".mysql_field_name($tempvalue["put_your_table_name_here"],$i)."</td>
                    <td width=\"33%\" align=\"center\">".mysql_field_type($tempvalue["put_your_table_name_here"],$i)."</td>
                    <td width=\"34%\" align=\"center\">".mysql_field_len($tempvalue["put_your_table_name_here"],$i)."</td>
                      </tr>");
                    }*/

/************************************************************************/
/*SAMPLE 4: GETS TABLE LIST */
/************************************************************************/
/*Put a database name before uncomment those lines */
/************************************************************************/

//$metadata->getTables("put_a_database_here");

/************************************************************************/
/*SAMPLE 5: GETS DATABASE LIST */
/************************************************************************/

$metadata->getDataBases();

/************************************************************************/
/*SAMPLE 6: DISCONNECT */
/************************************************************************/

$metadata->disconnect();
?>