diff --git a/reference/mysqli/mysqli_result/field-count.xml b/reference/mysqli/mysqli_result/field-count.xml index e98a465971..56e1503152 100644 --- a/reference/mysqli/mysqli_result/field-count.xml +++ b/reference/mysqli/mysqli_result/field-count.xml @@ -4,7 +4,7 @@ mysqli_result::$field_count mysqli_num_fields - Get the number of fields in a result + Gets the number of fields in the result set @@ -17,7 +17,7 @@ mysqli_resultresult - Returns the number of fields from specified result set. + Returns the number of fields in the result set. @@ -33,7 +33,7 @@ &reftitle.returnvalues; - The number of fields from a result set. + An int representing the number of fields. @@ -44,28 +44,16 @@ query("SELECT Name, CountryCode, District, Population FROM City ORDER BY ID LIMIT 1"); -if ($result = $mysqli->query("SELECT * FROM City ORDER BY ID LIMIT 1")) { +/* Get the number of fields in the result set */ +$field_cnt = $result->field_count; - /* determine number of fields in result set */ - $field_cnt = $result->field_count; - - printf("Result set has %d fields.\n", $field_cnt); - - /* close result set */ - $result->close(); -} - -/* close connection */ -$mysqli->close(); -?> +printf("Result set has %d fields.\n", $field_cnt); ]]> @@ -74,34 +62,22 @@ $mysqli->close(); +printf("Result set has %d fields.\n", $field_cnt); ]]> &examples.outputs;