php man page for mysqli_num_fields

Query: mysqli_num_fields

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

MYSQLI_NUM_FIELDS(3)							 1						      MYSQLI_NUM_FIELDS(3)

mysqli_result::$field_count - Get the number of fields in a result

       Object oriented style

SYNOPSIS
int$mysqli_result->field_count ()
DESCRIPTION
Procedural style int mysqli_num_fields (mysqli_result $result) Returns the number of fields from specified result set.
PARAMETERS
o $ result -Procedural style only: A result set identifier returned by mysqli_query(3), mysqli_store_result(3) or mysqli_use_result(3).
RETURN VALUES
The number of fields from a result set.
EXAMPLES
Example #1 Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } if ($result = $mysqli->query("SELECT * FROM City ORDER BY ID LIMIT 1")) { /* determine number of fields in result set */ $field_cnt = $result->field_count; printf("Result set has %d fields. ", $field_cnt); /* close result set */ $result->close(); } /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } if ($result = mysqli_query($link, "SELECT * FROM City ORDER BY ID LIMIT 1")) { /* determine number of fields in result set */ $field_cnt = mysqli_num_fields($result); printf("Result set has %d fields. ", $field_cnt); /* close result set */ mysqli_free_result($result); } /* close connection */ mysqli_close($link); ?> The above examples will output: Result set has 5 fields.
SEE ALSO
mysqli_fetch_field(3). PHP Documentation Group MYSQLI_NUM_FIELDS(3)
Related Man Pages
mysqli_data_seek(3) - php
mysqli_fetch_field(3) - php
mysqli_fetch_field_direct(3) - php
mysqli_field_seek(3) - php
mysqli_result.field_count(3) - php
Similar Topics in the Unix Linux Community
Preserve byte size of fields while pasting it to other file
Preserve byte size of fields while pasting it to other file in unix