connect_errno) { printf("Connect failed: %s\n", $mysqli->connect_error); exit(); } $i = 0; $hostTypes = array(); // Sets sql charset to utf-8 $mysqli->set_charset("utf8"); $sql = "SELECT HostType, COUNT(HostType) AS "Num" FROM serverlist GROUP BY HostType"; // Fill 2-dimensional array with article preview details $query = $mysqli->query($sql); $query_num = $query->num_rows; if (!empty($query_num)) { while($query_row = $query->fetch_assoc()) { $hostTypes($i) = $query_row['Num']; $i++; } } ?>