From 71864b3585eb6e98f858701544c969ff2979aa9a Mon Sep 17 00:00:00 2001 From: Gonzalo Merayo Date: Tue, 24 Jun 2003 19:43:45 +0000 Subject: [PATCH] Permito mostrar tablas sin padre --- lib/MECON/HTML/Arbol/ArbolDB.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/MECON/HTML/Arbol/ArbolDB.php b/lib/MECON/HTML/Arbol/ArbolDB.php index 13e9d99..3a5f9b9 100644 --- a/lib/MECON/HTML/Arbol/ArbolDB.php +++ b/lib/MECON/HTML/Arbol/ArbolDB.php @@ -7,7 +7,7 @@ require_once 'DB.php'; class HTML_ArbolDB extends HTML_Arbol { - var $padre; + var $padre = null; var $tabla; var $nombre; var $id; @@ -16,7 +16,8 @@ class HTML_ArbolDB extends HTML_Arbol function HTML_ArbolDB($dbdata, $imagen) { - $this->padre = $dbdata['id_padre']; + if(isset($dbdata['id_padre'])) + $this->padre = $dbdata['id_padre']; $this->tabla = $dbdata['tabla']; $this->nombre = $dbdata['nombre']; $this->id = $dbdata['id']; @@ -29,8 +30,9 @@ class HTML_ArbolDB extends HTML_Arbol function BuscarHijos($id) { $sql = "SELECT $this->nombre, $this->id - FROM $this->tabla - WHERE $this->padre = '$id'"; + FROM $this->tabla"; + if(!is_null$this->padre) + $sql .= "WHERE $this->padre = '$id'"; $result = $this->db->query($sql); if(DB::isError($result)) die($result->getMessage()); -- 2.43.0