I've just built a website to add Music Albums for sale. I've created a page where I can display all of the albums posted on a specific day using a URL ( add/2016-12-15 ). The problem is that it isn't quite working correctly on the live version. Here is my code:
<?php
if(isset($_GET["date"])){$date = $_GET["date"];}else{
header("Location: $site_url");
exit();
};
?>
<?php
$count_albums_sql = "SELECT id FROM albums WHERE Date(added) = '$date'";
$count_albums_res = mysqli_query($con, $count_albums_sql);
$num_init_albums = mysqli_num_rows($count_albums_res);
//If None, Then Exit
if($num_init_albums == 0){
header("Location: $site_url");
exit();
}
$albums_sql = "SELECT albums.id, albums.added, albums.band, albums.title, albums.genre, albums.format, albums.released, albums.label, albums.link, bands.name FROM albums LEFT JOIN bands ON albums.band = bands.id WHERE Date(albums.added) = '$date'";
$albums_res = mysqli_query($con, $albums_sql);
...
When I visit the URL I'm not being redirected back to the homepage ($site_url
), so it must be picking up the correct information from the URL, but it's not showing the results. Does anyone see any problems or know why this isn't working properly?