I am wanting to:
count how many rows that have the column date = $date
second count hows many rows the column date = $date AND column result = word 'win'
then divide the first count value by the second and echo the result/value.
The value is returing as 1 - when the number of rows = 3 , those with Win in result column = 2 , the result should be 1.5.
When I even do echo "".$testrow['win_count'] . ""; the result is still 3, which is wrong thats the result of total number of rows.
  <?php
    ini_set('display_errors', 1); error_reporting(E_ALL ^ E_NOTICE);
    $connection = mysqli_connect("*****", "*****", "*****", "*****");
    if (!$connection) {
        die("Database connection failed: " . mysqli_connect_error());
    }
    $Date = '2019-03-11';
    $Win = 'Win';
$testsql="
SELECT 
count(*) AS bet_count,
count(IF(result ='$Win', 1, 0)) AS win_count
FROM bets WHERE betDate = '$Date' GROUP BY betDate 
";
    $testresult = mysqli_query($connection, $testsql);
while ($testrow = mysqli_fetch_assoc($testresult))
{ 
    echo "<tr>";
echo "<td class='text-center'>".($testrow['bet_count']/$testrow['win_count']). "</td>";
echo "</tr>";
}
mysqli_close($connection);
?>
 
    