I was looking in the php manual and found two functions that look very similar to me:
mysqli_result::$field_count or mysqli_num_fields
and
mysqli::$field_count or mysqli_field_count()
Do they differ in any way?
I was looking in the php manual and found two functions that look very similar to me:
mysqli_result::$field_count or mysqli_num_fields
and
mysqli::$field_count or mysqli_field_count()
Do they differ in any way?
Those two functions accept different parameters:
mysqli_num_fields()
accepts a $con
variable - the mysql connection variable - and returns the number of rows for the latest query preformed using this connection.mysqli_field_count()' accepts a
$result` variable - the result set of any previous query - and returns its number of returned row.You could presumably use mysqli_field_count()
for your latest query, but you could never use mysqli_num_fields()
for any query but your most recent one.
this may help:
Object oriented style
int mysqli->field_count ;
Procedural style
int mysqli_field_count(mysqli link);
Returns the number of columns for the most recent query on the connection represented by the link parameter. This function can be useful when using the mysqli_store_result function to determine if the query should have produced a non-empty result set or not without knowing the nature of the query.
for more detail visit here:http://dev.mysql.com/doc/apis-php/en/apis-php-mysqli.field-count.html
Object oriented style
int mysqli_result->field_count ;
Procedural style
int mysqli_num_fields(mysqli_result result);
Returns the number of fields from specified result set.
for more detail visit here:http://dev.mysql.com/doc/apis-php/en/apis-php-mysqli-result.field-count.html
you can see in both the cases one receives a input but the other does not