05.12.2015, 22:01
Quote:
I don't know if this is the best method to do it or not though, Kaperstone might help u more about it...
|
On his post he requests to count columns, you answered how to count rows, and so I confused.
However, to count fields
PHP код:
$mysqli->query("SELECT * FROM `users` LIMIT 0")->field_count
PHP код:
$mysqli->query("SELECT count(*) FROM `users`")->fetch_array()[0]
I see there is a small confusion between rows, fields and columns, so I want to clarify the difference:
Field's are the values that are being fetched
Columns are vertical rows that you can name in order to know which data to fetch out of a set.
Rows are the horizontal rows that contain the data you stored, you can add an ID and use it as an index to each row of data.