All questions on the bottom
Right now I am working along with STYS php in 24hrs(Sams)
I am using the following code
<?php
//connect to the mysql database
$link = mysql_connect("localhost", $user, $pass);
//make sure it worked
if (!$link)
die("Couldn't connect to MySQL");
//get list of available databases
$db_res = mysql_list_dbs($link);
//loop through the available databases
while($db_rows = mysql_fetch_row($db_res))
{
print"<b>$db_rows[0]</b>\n";
//check to see if you are able to select that database
if([EMAIL PROTECTED]($db_rows[0], $link))
{
print "<dl><dd>couldn't connect -- ".mysql_error()."</dl>";
continue;
}
//get list of tables for the above database
$tab_res = mysql_list_tables($db_rows[0],$link);
print "\t<dl><dd>\n";
//loop throught the table geting the rows
while($tab_rows = mysql_fetch_row($tab_res))
{
print "\t<b>$tab_rows[0]</b>\n";
$query_res = mysql_query("select * from $tab_rows[0]");
$num_fields = mysql_num_fields($query_res);
print "\t\t<dl><dd>\n";
for($x = 0; $x < $num_fields; $x++)
{
print "\t\t<i>";
print mysql_field_type($query_res, $x);
print "</i> <i>";
print mysql_field_len($query_res, $x);
print "</i> <b>";
print mysql_field_name($query_res, $x);
print "</b> <i>";
print mysql_field_flags($query_res, $x);
print "</i> <br>\n";
}
print "\t\t</dl>\n";
}
print "\t</dl>\n";
}
mysql_close($link);
I am having problems with the FOR LOOP. Here is a portion of the
results from the query from my mozilla browser
harrysdb
domains
unknown 1 id
unknown 10 domain
unknown 1 sex
unknown 19 mail
mysql
columns_priv
unknown 0 Host
unknown 0 Db
unknown 0 User
unknown 0 Table_name
unknown 0 Column_name
unknown 0 Timestamp
unknown 0 Column_priv
db
unknown 1 Host
unknown 7 Db
unknown 0 User
unknown 1 Select_priv
unknown 1 Insert_priv
unknown 1 Update_priv
unknown 1 Delete_priv
unknown 1 Create_priv
unknown 1 Drop_priv
unknown 1 Grant_priv
unknown 1 References_priv
unknown 1 Index_priv
unknown 1 Alter_priv
unknown 1 Create_tmp_table_priv
real 1 Lock_tables_priv
Why is it coming up with unknown for the field type and the field length
is wrong and field flags not showing either?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php