Hello i trying to select date from mysql between date's with this code:
if (empty($_GET['date-range1'])) {
$sql=mysql_query("SELECT * FROM sohy_raports ORDER BY ".$_GET['sort']." ".$_GET['ad']."");
} else {
$sql=mysql_query("SELECT * FROM sohy_raports WHERE date BETWEEN ".$_GET['date-range1']." AND ".$_GET['date-range2']." ORDER BY ".$_GET['sort']." ".$_GET['ad']."");
}
but with this code i can't select between date's only between id's. It can be from date format error Y-mm-dd ?
Thanks
$_GET['date-range1']and$_GET['date-range2']? Also, your code is widely open to SQL injection attacks, you might want to read up on that if you plan on putting this code on the public internet.$_GET['date-range1']is empty then how it will check for between and you missed comma between sort and ad..