PHP date between with variables
<p>I want to pass those variable with the function but I get Array:0</p>

<pre><code>public function getFechaData($fecha1, $fecha2)
{
    $stmt = mysqli_prepare($this-&gt;connection, "SELECT fecha, nacionalidad, COUNT(*) as cantidad FROM $this-&gt;tablename WHERE fecha BETWEEN '$fecha1' AND 'fecha2' GROUP BY fecha");      
    $this-&gt;throwExceptionOnError();

    mysqli_stmt_execute($stmt);
    $this-&gt;throwExceptionOnError();

    $rows = array();
    $row = new stdClass();
    mysqli_stmt_bind_result($stmt, $row-&gt;fecha, $row-&gt;nacionaliad, $row-&gt;cantidad);

    while (mysqli_stmt_fetch($stmt)) 
    {
        $row = new stdClass();
        mysqli_stmt_bind_result($stmt,  $row-&gt;fecha, $row-&gt;nacionaliad, $row-&gt;cantidad);
        $rows[] = $row;
    }

    mysqli_stmt_free_result($stmt);
    mysqli_close($this-&gt;connection);

    return $rows;
}
</code></pre>
