<?php
require_once 'connect_db.php';
function getCategory() {
global $mysqli;
connectDB();
$result = $mysqli->query("SELECT * FROM `shop` GROUP BY `category` ORDER BY `category` DESC");
closeDB();
return resultToArray5($result);
}
function resultToArray5($result){
$array = array ();
while (($row = $result->fetch_assoc()) != false)
$array[] = $row;
return $array;
}
print_r(getCategory());
?>