this is my code
$totalDates = "SELECT COUNT( DISTINCT date )
FROM table_name";
$result = mysqli_query($connection, $totalDates);
$totalDates = mysqli_fetch_array($totalDates, MYSQLI_NUM);
echo "there are total $totalDates Distinct Rows";
i want to get the no of distinct dates from table_name but it giving me this error , what i might be doing wrong ?
Error: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given
P.S : i ran the sql code in the query windows , its working fine there and gave me an integer value.