1$sql = "SELECT COUNT(*) AS total from Members";
2$result = $conn->query($sql);
3$data = $result->fetch_assoc();
4echo $data['total'];
1
2<?php
3$a[0] = 1;
4$a[1] = 3;
5$a[2] = 5;
6var_dump(count($a));
7
8$b[0] = 7;
9$b[5] = 9;
10$b[10] = 11;
11var_dump(count($b));
12
13var_dump(count(null));
14
15var_dump(count(false));
16?>
17 /* result
18
19
20int(3)
21int(3)
22
23Warning: count(): Parameter must be an array or an object that implements Countable in … on line 12 // as of PHP 7.2
24int(0)
25
26Warning: count(): Parameter must be an array or an object that implements Countable in … on line 14 // as of PHP 7.2
27int(1)
28
29*/
30
31