I have two possible solutions:
1.) it could be because you have a semi-colon after your while loop closing curly bracket.
2.) Whenever I user MySQL_fetch_array I index the $row variable.
like:
$query = "SELECT catID,cat_name,categoryColor FROM Categories";
while ($row = mysqli_fetch_array($result)) {
$cat_id = $row['catID'];
$catName = $row['cat_name'];
$catColor = $row['categoryColor'];
My example
while ($row = mysqli_fetch_array($result)) {
$cat_id = $row[0];
$catName = $row[1];
$catColor = $row[2];