List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 27 1999 4:44pm
Subject:Re: Getting field names from a given table
View as plain text  
At 12:30 PM -0400 7/27/99, Rich Bowen wrote:
>al wrote:
>>
>> Does anyone no a way that I can get a list of all the field names I am
>> using in a particular mysql table? That is, is there a way either using
>> the mysql command-line client or the Perl DBI module to do this?
>
>With Perl, you can ...
>
>$sth = $dbh->prepare("select * from table");
>$sth->execute;
>$Data = $sth->fetchrow_hashref;
>for (keys %$Data)	{
>	print "$_\n";
>}


You might want to change that query to "select * from table where 1=0"
so you don't fetch the entire table. :-)

-- 
Paul DuBois, paul@stripped
Thread
Getting field names from a given tableal27 Jul
  • Re: Getting field names from a given tablePaul DuBois27 Jul
  • Re: Getting field names from a given tableJeff Urban27 Jul
  • Getting field names from a given tablesinisa27 Jul
  • Re: Getting field names from a given tableRich Bowen27 Jul
    • Re: Getting field names from a given tablePaul DuBois27 Jul