Re: PHP/MySQL question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Israel wrote:
> 
> 
> 
> Hi all,
> 
> Happy New Year.
> 
> I'm working on an application and had a couple of related PHP/MySQL
> questions.
> 
> 1. When I do a MySQL query, is there a way to get the returned columns in
> the query without fetching a row? Currently, what I'm doing is fetching a
> row of data and getting the keys from the array. I'd like to do it without
> fetching the row. Is this possible?
You can take a look at 
http://dev.mysql.com/doc/refman/5.0/en/show-columns.html

In short: just execute this query and you'll get all columns for a table:

SHOW COLUMNS FROM tablename

You might want to use http://php.net/var_dump to see what the output for 
this query is and then use that information to get the exact information 
you're looking for, since SHOW COLUMNS might tell you more than just 
columnnames.


> 
> 2. If #1 above is indeed possible, is this only possible when I get returned
> rows or can I do it when there are no matching rows in the query?
I think my previous answer already told you everything...

~ Ruben


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux