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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.