<?php

//add some security check
//ini_set('include_path', '../_class/');
include('/home/livingsp/badminton.livingsport.hu/_class/class_sql.php');
//$sql = new sql('cegled_mysql','root','','badminton_coach');
$sql = new sql('localhost','livingsp_coach','R186er012qw5','livingsp_badminton');

//get today trainings
$today = date("Y-m-d");

$trainings = $sql->assoc_array("SELECT * FROM training WHERE tr_locked = 0 AND tr_deleted = 0 AND tr_date LIKE '{$today}%'");

foreach ($trainings as $key => $training) {
    $sql->update_table("training", array(
        "tr_locked" => 1
    ),
    array(
        "tr_id" => $training["tr_id"]
    ));
}

?>
