From 8408636fa5db7d57f15aeaa5e36254f2b84e2297 Mon Sep 17 00:00:00 2001 From: marian1010 <79144276+marian1010@users.noreply.github.com> Date: Thu, 6 May 2021 07:44:01 +0200 Subject: [PATCH] Update template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ComprobaciĆ³n antes de imprimir cines, al no haber cines da error en el xamp --- assets/php/template.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/assets/php/template.php b/assets/php/template.php index ea047ea..61c9ee1 100644 --- a/assets/php/template.php +++ b/assets/php/template.php @@ -376,14 +376,14 @@ $names = array(); $directions = array(); $phones = array(); - - foreach($cinemas as $key => $value){ - $ids[$key] = $value->getId(); - $names[$key] = $value->getName(); - $directions[$key] = $value->getDirection(); - $phones[$key] = $value->getPhone(); + if(is_array($cinemas)){ + foreach($cinemas as $key => $value){ + $ids[$key] = $value->getId(); + $names[$key] = $value->getName(); + $directions[$key] = $value->getDirection(); + $phones[$key] = $value->getPhone(); + } } - switch($this->page){ case "Panel de Administrador": echo "
@@ -400,6 +400,7 @@ "; + if(is_array($cinemas)){ for($i = 0; $i < count($cinemas); $i++){ echo ' '. $ids[$i] .' @@ -427,6 +428,7 @@ '; } + } echo'