function done($conn, $done_type) { switch ($done_type) { case "muell": $work_id = 1; break; case "pfand": $work_id = 2; break; case "ein": $work_id = 3; break; case "aus": $work_id = 4; break; case "kaffee": $work_id = 5; break; } $user_id = get_curent_user($conn, $work_id); $user_info = get_user_info($conn, $user_id); $count = $user_info['count_' . $done_type]; $count++; $sql = "UPDATE user SET count_" . $done_type . "=" . $count . " WHERE id=" . $user_id; $result = $conn->query($sql); $desc = $done_type . '_done'; $timedate = date("Y-m-d H:i:s"); $sql = "INSERT INTO work_log (Description, Date, User_ID) VALUES ('" . $desc . "','" . $timedate . "','" . $user_id . "')"; $result = $conn->query($sql); }
function done($conn, $done_type) { switch ($done_type) { case "muell": $work_id = 1; break; case "pfand": $work_id = 2; break; case "ein": $work_id = 3; break; case "aus": $work_id = 4; break; case "kaffee": $work_id = 5; break; } $user_id = get_curent_user($conn, $work_id); $user_info = get_user_info($conn, $user_id); $count = $user_info['count_' . $done_type]; $count++; $sql = "UPDATE user SET count_" . $done_type . "=" . $count . " WHERE id=" . $user_id; $result = $conn->query($sql); }