Working example (fixed and formatted):
$stmt = $mysqli->prepare("SELECT date, impressions, balance, username FROM reports WHERE username = '$username' and date between '$firstDay' AND '$lastDay'");
$stmt->execute();
$stmt->store_result();
$rows = $stmt->num_rows;
mysqli_stmt_bind_result($stmt, $date, $impressions, $balance, $username);
if ($rows > 0)
{
while (mysqli_stmt_fetch($stmt))
{
$ecpm_t3 = $balance * 1000;
$ecpm3 = $ecpm_t3 / $impressions;
$rate = number_format((float)$ecpm3, 2, '.', '');
echo "
$date |
$impressions |
$$rate |
$$balance |
";
}
}
else
{
echo "
Not rows |
";
}