I am aware that this question has been asked many times but the solutions doesn\'t seem to be working for me.
I am writing a simple blog and I wanted to make an arch
Have a read here: http://php.net/manual/en/mysqli.prepare.php prepare you get a false if it fails. Hence your error.
The issue is your SQL your need to use ?
in place of variable names and prepare expects the data to bind. I believe you want:
$sql = "SELECT * FROM posts WHERE date >= ? AND date <= ? ORDER BY date DESC";
$stmt->bind_param('ii', $from, $to);