PHP Code:
<?php
function getTimestamp($year, $month = 1, $day = 1, $hours = 0, $minutes = 0, $seconds = 0) {
return mktime($hours, $minutes, $seconds, $month, $day, $year);
}
$getdate = explode("-", $_POST['search_value']);
$year = isset($getdate[0]) ? $getdate[0] : false;
$month = isset($getdate[1]) ? $getdate[1] : false;
$day = isset($getdate[2]) ? $getdate[2] : false;
$start = getTimestamp($year, $month, $day);
if (!$month) {
$end = getTimestamp(($year + 1));
}
elseif (!$day) {
$end = getTimestamp($year, ($month + 1));
}
else {
$end = getTimestamp($year, $month, ($day + 1));
}
$search = 'DateJoined > ' . $start . ' AND DateJoined < ' . $end;
$Q = "select * from $members where $search";
$db_view->query($Q);
?>
Bookmarks