php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #5409 Mysql: Return Array of Fields
Submitted: 2000-07-06 17:49 UTC Modified: 2000-07-06 17:54 UTC
From: nathan at cjhunter dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.0 OS: Linux 2.0.14
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nathan at cjhunter dot com
New email:
PHP Version: OS:

 

 [2000-07-06 17:49 UTC] nathan at cjhunter dot com
I would like to see a mysql function that returns the field names of a query as an array of names. If this is good I elect mysql_fetch_fields() as the function name (with the added 's' on the end).

ex

$result = mysql_query("select * from table");

$fields = mysql_fetch_fields($result);

echo implode(",\n", $fields);
/* This would print out all the field names like so

field1,
field2,
field3,

This is just a conceptual example as I see better uses for this function
*/

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-06 17:54 UTC] rasmus at cvs dot php dot net
The mysql_list_fields() and the associated mysql_field_flags(), mysql_field_len, mysql_field_name and mysql_field_type functions sufficiently provide this functionality:
http://www.php.net/manual/function.mysql-list-fields.php
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 23 08:00:02 2026 UTC