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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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: Sat Jun 13 03:00:01 2026 UTC