Start with something like the following and add mysql_list_dbs () to query
the system for the available databases.
Hugh
Input Data Page
DATABASE TABLES
";
print "Database name:
";
print "Password:";
print "";
print "";
print "";
if ($start=="1")
{
$link=mysql_connect("localhost","","$pass");
if (! $link) die("couldn't connect mysql");
mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());
$tables=mysql_list_tables($db,$link);
$num=mysql_num_rows($tables)-1;
mysql_close($link);
?>
";
print "Table Name: ";
for ($i=0;$i<=$num;$i++)
{
print "".mysql_tablename($tables,$i);
}
print "";
print "";
print "";
print "";
print "";
print "";
}
if ($start=="2")
{
$link=mysql_connect("localhost","","$pass");
if (! $link) die("couldn't connect mysql");
mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());
$results=mysql_query("select * from $table");
$fields = mysql_list_fields("$db", "$table", $link);
$columns = mysql_num_fields($fields);
mysql_close($link);
print "$table";
print "";
print "";
for ($i = 0; $i < $columns; $i++)
{
print "".mysql_field_name($fields, $i)."";
}
print "";
print "";
for ($i = 0; $i < $columns; $i++)
{
print "".mysql_field_type($results,
$i)."";
}
print "";
while ($a_row=mysql_fetch_row($results))
{
print "";
foreach($a_row as $field)
{
if ($field=="")
{
$field=" ";
}
print "".$field."";
}
print "";
}
print "";
}
?>
- Original Message -
From: "jtjohnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 17, 2002 7:34 PM
Subject: [PHP] phpmyadmin-mysql
> Hello,
>
> I'm looking for code to display all my mysql databases in a .
> On change, I want to display all my tables in a .
> Finally, on change, it has to display all record of the table selected:
>
> Print Record
>
>
> id YR AU BT
> 1 1997 Fee, Margery Writing Orality: Interpreting Literature
> Display in English by Aboriginal Writers in North
> America, Australia and New Zealand
>
> Can someone give me a hand getting started?
> I would normally use phpmyadmin, but I want to customise something they
> don't offer.
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php