My connection to my database show some error
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in /---/---/---/function/function.php on line 10
<?php
$connection = mysqli_connect("localhost","root","password");
//getting the categories
function getCats(){
global $connection;
$get_cats = "select * from category";
$run_cats = mysqli_query($connection, $get_cats);
while ($row_cats = mysqli_fetch_array($run_cats)){
$cat_id = $row_cats['cat_id'];
$cat_title = $row_cats['cat_title'];
echo"<li><a href='#'>$cat_title</a></li>";
}
}
?>