RE: Help with showing tables in DB
| From: | Tim Ward | Date: | Wed, 27 Feb 2002 09:36:23 +0000 |
| Subject: | RE: Help with showing tables in DB | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-86391@lists.php.net to get a copy of this message | ||
Have you tried any diagnostic to find out what fields are being returned by
the query, something like:
If ($result = mysql_query("show tables"))
{ while ($row = mysql_fetch_array($result))
{ foreach($row as $fieldname=>$value) echo("$fieldname=>$value<br>");
}
}
I think you'll find the field you want is something like "Tables_in_dbname".
Tim Ward
www.chessish.com <http://www.chessish.com>
----------
From: Ron Clark [SMTP:rclark@swbanktx.com]
Sent: 26 February 2002 21:02
To: php-general@lists.php.net
Subject: Help with showing tables in DB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Consider the following:
mysql_select_db($db_name);
$result = mysql_query("show tables");
while ($rows = mysql_fetch_object($result)) {
echo $rows;
}
So why does this not return the Table names? I have even tried "echo
rows->Table" and "echo rows->Tables" to no avail. So how do I fix
this?
Thanks in advance,
Ron C.
-----BEGIN PGP SIGNATURE-----
Version: PGP 7.1
iQA/AwUBPHv32kSpEYIqgLQzEQISfQCeLVinx7oQc4Gmudv1MJbb17dGCPoAnA7S
yRR86rJUwHsXGJlU0yVckVyK
=2bva
-----END PGP SIGNATURE-----