Hi all..
I've a field in my database called CheckDate (type: date) in the format yyyy-mm-dd. I've 2 user inputs $start and $end in the format yyyy-mm-dd.
I would like to check if the CheckDate is between the dates, $start and $end.
The following are my codes:
$start = $_GET["start"];
$end = $_GET["end"];
$startDate = strtotime($start);
$endDate = strtotime($end);
$conn = mysql_connect("localhost","root","");
mysql_select_db("tsg",$conn);
$sql1 = "DELETE FROM log WHERE Updated >= '$startDate' AND Updated <= '$endDate'";
if (mysql_query($sql1,$conn)) { ?>
<script>
alert('Log successfully deleted.')
window.location = "log.php"
</script>
<?php
} else {
?>
<script>
alert('Unable to delete log.')
window.location = "log.php"
</script>
<?php } ?>
The problem is the logs which CheckDate falls between $startDate and $endDate are not deleted.
Is there anything wrong with my codes?