herstarcatcher wrote in php 😣cranky

Simple DB Query...

This won't work...

$yearmonth = `/bin/date +%Y-%m`;
$sql = "SELECT * FROM fff_news WHERE date LIKE '$yearmonth%' ORDER BY DATE_FORMAT(date, '%Y/%m/%d') DESC";

But this does...

$sql = "SELECT * FROM fff_news WHERE date LIKE '2004-12%' ORDER BY DATE_FORMAT(date, '%Y/%m/%d') DESC";

What am I doing wrong here?

Thanks!