Re: [PHP4BETA] PHP or MySQL?
| From: | David Robley | Date: | Tue, 18 Apr 2000 00:59:02 +0000 |
| Subject: | Re: [PHP4BETA] PHP or MySQL? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-13650@lists.php.net to get a copy of this message | ||
On 18 Apr, Bradley wrote:
> I'm not sure if this is a MySQL question or a PHP question, but I
> thought I'd try you guys first. Within the mysql program, when I
> perform a SELECT it returns the column names along with the specified
> rows, but when I perform the same SELECT using PHP I only get the
> requested rows. Bug or feature? =) I need to be able to grab the
> column names so that I can turn them into an option box so that users
> can sort by whichever row they like when sending the select. Does that
> make sense? It seems like a trivial thing, but I can't seem to find it
> anywhere.
>
> Help!
Presumably you are doing a SELECT * FROM... otherwise you would be
specifying the field names and could use that list. But I think what you
may want is mysql_list_fields and mysql_field_name, which will give you
all the field names for a given table. There are a couple of other
mysql_field_xxx commands that you may find useful for determining the
type of field and hence whether a sort should be allowed (say on a
blob).
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA