mysqli_num_fields()

$result_set->field_count;
mysqli_num_fields($result_set)
The input parameter $result_set is the output of result set identifier of mysqli_query(), mysqli_store_result() or mysqli_use_result().

The output is number of fields present in the result set.

MySQLI database connection file

Example : Object Oriented Style
<?Php
require "config.php";// Database connection file.

if ($result = $connection->query("SELECT * FROM student")) {
    
$field_no = $result->field_count;
echo " Total Number of Fields ".$field_no;
 $result->close();
}
?>
Total Number of Fields 5

MySQL SELECT Query

Procedural style
<?Php
require "config.php";// Database connection file.

if ($result_set = mysqli_query($connection,$query)) {
echo "Total No. of fields :".mysqli_num_fields($result_set);
    mysqli_free_result($result_set);
}
?>
Total No. of fields :5

MySQL DUMP of student table

Your Rating





Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer