Name

mysql_num_fields

Synopsis

int mysql_num_fields(qresource query)

Returns the number of attributes in a row associated with the query resource handle parameter. The query resource handle is returned from a prior call to mysql_list_fields( ), mysql_query( ), or mysql_unbuffered_query( ).

Example

<?php
  $connection = mysql_connect("localhost", "fred", "shhh");
  
  $result = mysql_list_fields("wedding", "presents", $connection);
  
  echo "There are " . mysql_num_fields($result) . " attributes in presents";
?>

Get Managing & Using MySQL, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.