From a3051835f7095013fb9760e6d06d190f584fc609 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 3 Sep 2021 14:59:33 +0100 Subject: [PATCH] Updating mysqli: mysqli_num_fields * Aligned wording * Explicitely list columns to make it obvious where the number comes from Closes GH-892. --- .../mysqli/mysqli_result/field-count.xml | 56 ++++++------------- 1 file changed, 16 insertions(+), 40 deletions(-) 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;