diff --git a/admin/header.php b/admin/header.php index 63dd5a0..4f82943 100644 --- a/admin/header.php +++ b/admin/header.php @@ -12,10 +12,10 @@ if(!$db) exit("Database connection error: ".mysqli_connect_error()); // Datenbankabfrage aktueller Wochenplan - $sql = 'SELECT * FROM schedules WHERE calendar_week = ?'; + $sql = 'SELECT * FROM schedules WHERE calendar_week = ? AND year = ?'; $sql_query = mysqli_prepare($db, $sql); - if (!$sql_query) die('ERROR: could not prepare sql: '.$sql); - mysqli_stmt_bind_param($sql_query, 'i', date('W')); + if (!$sql_query) die('ERROR: Failed to prepare SQL.'); + mysqli_stmt_bind_param($sql_query, 'is', date('W'), date('Y')); mysqli_stmt_execute($sql_query); $current_schedule = mysqli_fetch_assoc(mysqli_stmt_get_result($sql_query)); mysqli_stmt_close($sql_query); diff --git a/index.php b/index.php index 69e1d1c..8242496 100644 --- a/index.php +++ b/index.php @@ -15,10 +15,10 @@ if(!$db) exit('Database connection error: '.mysqli_connect_error()); // Datenbankabfrage aktueller Wochenplan - $sql = 'SELECT * FROM schedules WHERE calendar_week = ?'; + $sql = 'SELECT * FROM schedules WHERE calendar_week = ? AND year = ?'; $sql_query = mysqli_prepare($db, $sql); if (!$sql_query) die('ERROR: Failed to prepare SQL.'); - mysqli_stmt_bind_param($sql_query, 'i', date('W')); + mysqli_stmt_bind_param($sql_query, 'is', date('W'), date('Y')); mysqli_stmt_execute($sql_query); $current_schedule = mysqli_fetch_assoc(mysqli_stmt_get_result($sql_query)); mysqli_stmt_close($sql_query);