From 444037f7ff6606fbf9896787ce2a6b59b4b531cb Mon Sep 17 00:00:00 2001 From: TPLinux Date: Thu, 29 Jun 2017 15:53:53 +0000 Subject: [PATCH] Fix in_array bug in show more buldings in WWV --- Templates/Build/avaliable.tpl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index 28873714..b1511277 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -171,14 +171,16 @@ $query = mysql_query("SELECT * FROM ".TB_PREFIX."vdata WHERE owner = ".$user."") while($villaggi_array = mysql_fetch_array($query)){ //loop structure village - $query1 = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".$villaggi_array['wref'].""); - $strutture= mysql_fetch_array($query1); - + $query1 = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".$villaggi_array['wref'].""); + $strutture= mysql_fetch_array($query1); + if($strutture == false) + $strutture = []; //search Castle in array structure village -$test = in_array(26,$strutture); +$test = in_array(26,$strutture); + if ($test){ - break; - } + break; +} } @@ -297,7 +299,10 @@ while($villaggi_array = mysql_fetch_array($query)){ $strutture= mysql_fetch_array($query1); //search Castle in array structure village -$test = in_array(26,$strutture); + if($strutture !== false) + $test = in_array(26,$strutture); + else + $test = in_array(26,[]); if ($test){ break; } @@ -466,4 +471,4 @@ function show_build_list(list) { - \ No newline at end of file +