I have a website where posts are recorded in a MySQL Table with an Added
value, which is set to DateTime. An example of a stored value is 2016:12:12 15:30:21
.
So I now want to build a page which selects all records of a certain date, using a php script and URL paramater like added.php?date=2016-12-12
.
So my php script for this would be:
<?php
if(isset($_GET["date"])){
$date = $_GET["date"];
} else {
header("Location: $site_url");
exit();
};
?>
How do I now actually select the rows with this date? I'm trying to use:
$rows_sql = "SELECT id FROM posts WHERE added = '$date';
But this isn't working. Any ideas how I can get this working in the format I have?