From: "Vania Smrkovski" <[EMAIL PROTECTED]>

> host with PHP and MySQL support.
> a) How would you change the following the automatically find the tables
> run through the iteration.

You should rtfm as php/mysql makes a lot of the torturous
VB/MS/Access methods very simple. All the functions below
are straight from the book.

$colordb = "#3333aa";
$colortbl = "#33aa33";
$link = mysql_connect ("host", "user", "password")
        or die ("Could not connect");
print ("Connected successfully<br>");
print ("List of all <b><font color='$colordb'>databases</font></b>/<font
color='$colortbl'><b>tables</b></font>/<b>fields</b> on server<br>");
$dbResult = mysql_list_dbs($link);
  while($this_db = mysql_fetch_row($dbResult)) {
    print("&nbsp;<font color='$colordb'><b>".$this_db[0]."</b></font><br>");
    $tblResult = mysql_list_tables ("$this_db[0]");
    $i = 0;
       while ($i < mysql_num_rows ($tblResult)) {
         $this_tbl[$i] = mysql_tablename ($tblResult, $i);
         echo "&nbsp;&nbsp;<font color='$colortbl'><b>".$this_tbl[$i] .
         $fld_Result = mysql_list_fields("$this_db[0]", "$this_tbl[$i]",
         $nflds = mysql_num_fields($fld_Result);
         echo "&nbsp;(".$nflds.")<br>";
         print("<div align='left'><TABLE>\n");
           for($j = 0; $j < $nflds; $j++) {
               <TD>&nbsp;<b>" . mysql_field_name($fld_Result, $j) .
               <TD>" . mysql_field_type($fld_Result, $j) . "</TD>
               <TD>" . mysql_field_len($fld_Result, $j) . "</TD>
               <TD>" . mysql_field_flags($fld_Result, $j) . "</TD>
    mysql_close ($link);

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to