RE: PHP/MySQL question

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

 



It's a good trick, but it doesn't exactly answer my question.  The query may
(or may not) have all the columns in the table and it may have columns from
several tables.

-D. Israel
dan@xxxxxxxx
http://www.customcodebydan.com 
AIM: JudoDanIzz

A BANDAID!? Damn it Jim,I'm a doctor,not a-oh, never mind

> -----Original Message-----
> From: Ruben Nijveld [mailto:mail@xxxxxxxxxxxx]
> Sent: Sunday, December 30, 2007 11:02 AM
> To: php-objects@xxxxxxxxxxxxxxx
> Subject: Re:  PHP/MySQL question
> 
> 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
> 
> 
> 
> Are you looking for a PHP job? Join the PHP Professionals directory
> Now!
> http://www.phpclasses.org/professionals/
> Yahoo! Groups Links
> 
> 
> 


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

  Powered by Linux