From 4e57885e540bac18b5cc7cec4accbbbb24590898 Mon Sep 17 00:00:00 2001
From: tonyford <tonyford@strategy-investor.de>
Date: Sun, 16 Oct 2022 09:26:59 +0200
Subject: [PATCH] bugfix

---
 html/_layouts/default.php     | 16 ++++++++--------
 html/functions/db_methods.php |  5 +++--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/html/_layouts/default.php b/html/_layouts/default.php
index 3bd1e9f..a0a56c8 100644
--- a/html/_layouts/default.php
+++ b/html/_layouts/default.php
@@ -1,5 +1,10 @@
 <?php
 
+ini_set('display_errors', 1);
+ini_set('log_errors',1);
+error_reporting(E_ALL);
+mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
+
 define( 'SAISON', '{{ page.saison }}' );
 define( 'SAISON_NOW', '{{ site.data.global.saison_now }}' );
 
@@ -7,9 +12,6 @@ include_once('functions/db_connect.php');
 include_once('functions/db_methods.php');
 
 
-$csv=$_POST['csv'];
-$secret='';
-
 $UNKNOWN=[];
 $T = db_getFromTeams();
 foreach( $T as $t ){
@@ -18,10 +20,8 @@ foreach( $T as $t ){
 }
 
 
-$spielerdebut=json_encode( db_getLatestFromSpieler() );
-sleep(2);
-if( ! $spielerdebut ) $spielerdebut='[]';
-
+if( !empty($_POST['csv']) ) $csv=$_POST['csv'];
+$secret='';
 
 if( !empty($csv) ){
 
@@ -96,7 +96,7 @@ if( !empty($csv) ){
     }
     var SPIELER=<?=json_encode( db_getFromSpieler() )?>;
     var UNKNOWN=<?=json_encode( $UNKNOWN )?>.reduce((a,b) => (a.concat(b)));
-    var NEUESPIELER=<?= $spielerdebut ?>;
+    var NEUESPIELER=<?= json_encode( db_getLatestFromSpieler() ) ?>;
     var ERGEBNISSE=<?=json_encode( db_getFromErgebnisse() )?>;
     var STAT_SAISON=<?=json_encode( db_getFromStatistikBySaison(SAISON))?>;
     var STAT_ALL=<?=json_encode( db_getFromStatistik())?>;
diff --git a/html/functions/db_methods.php b/html/functions/db_methods.php
index 9e4da9b..06894bd 100644
--- a/html/functions/db_methods.php
+++ b/html/functions/db_methods.php
@@ -318,8 +318,9 @@ function db_getLatestFromSpieler($days=34){
 
   $ROW=Array();
   while( $row = $result->fetch_assoc() ){
-    $row['id']=bin2hex($row['id']);
-    $row['SpielerID']=bin2hex($row['SpielerID']);
+    $row['SpielerID']=bin2hex($row['id']);
+    unset($row['id']);
+    //$row['SpielerID']=bin2hex($row['SpielerID']);
     $ROW[]=$row;
   }
 
-- 
GitLab