downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<mysql_list_tablesmysql_num_rows>
Last updated: Thu, 26 Jun 2008

mysql_num_fields

(PHP 4, PHP 5, PECL mysql:1.0)

mysql_num_fields — Get number of fields in result

Description

int mysql_num_fields ( resource $result )

Retrieves the number of fields from a query.

Parameters

result

The result resource that is being evaluated. This result comes from a call to mysql_query().

Return Values

Returns the number of fields in the result set resource on success, or FALSE on failure.

Examples

Example #1 A mysql_num_fields() example

<?php
$result
= mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!
$result) {
   echo
'Could not run query: ' . mysql_error();
   exit;
}

/* returns 2 because id,email === two fields */
echo mysql_num_fields($result);
?>

Notes

Note: For backward compatibility, the following deprecated alias may be used: mysql_numfields()



add a noteadd a note User Contributed Notes
Get number of fields in result
There are no user contributed notes for this page.




<mysql_list_tablesmysql_num_rows>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs