Re: Getting the tables of a db by using _query()
| From: | jeremy brand | Date: | Sun, 08 Oct 2000 10:01:57 +0000 |
| Subject: | Re: Getting the tables of a db by using _query() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19076@lists.php.net to get a copy of this message | ||
this bit of oode returns the names of the fields for me:
$q = "SHOW TABLES";
$r = mysql_query($q);
if ($r)
while($row= mysql_fetch_array($r))
print $row[0] . "\n";
-jeremy brand
_______________________________________________________________________
GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9
_ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more __
_ http://www.google.com/search?q=jeremy+brand
__
> Date: Sun, 8 Oct 2000 12:42:00 +0300
> From: Markus Syrjänen <ravel@ee.oulu.fi>
> To: php-general@lists.php.net
> Subject: [PHP] Getting the tables of a db by using _query()
>
> hi,
>
> I'm trying to get the tables of a db (and fields of the tables) by first
> using mysql_query("show tables"), but this doesn't seem to return anything
> useful. How can I do this?
>
> Note that I don't want to use mysql_list_tables or mysql_list_fields because
> I'll probably have to port this script to another scripting languages, too.
> The existence of these functions made me think there must be a sql query
> that does the same trick.
>
> - markus
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>