Skip to content

Commit

Permalink
check year when fetching current schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
wbrtm committed Jun 15, 2020
1 parent 10449ec commit 1d928ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions admin/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1d928ef

Please sign in to comment.