From: "Vania Smrkovski" <[EMAIL PROTECTED]>
> host with PHP and MySQL support.
>
> a) How would you change the following the automatically find the tables
and
> 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.
<?php
$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(" <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 " <font color='$colortbl'><b>".$this_tbl[$i] .
"</b></font>";
$fld_Result = mysql_list_fields("$this_db[0]", "$this_tbl[$i]",
$link);
$nflds = mysql_num_fields($fld_Result);
echo " (".$nflds.")<br>";
print("<div align='left'><TABLE>\n");
for($j = 0; $j < $nflds; $j++) {
print("<TR>
<TD> <b>" . mysql_field_name($fld_Result, $j) .
"</b></TD>
<TD>" . mysql_field_type($fld_Result, $j) . "</TD>
<TD>" . mysql_field_len($fld_Result, $j) . "</TD>
<TD>" . mysql_field_flags($fld_Result, $j) . "</TD>
</TR>\n");
}
print("</TABLE></div>\n");
$i++;
}
}
mysql_close ($link);
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php