From: Gonzalo Merayo Date: Tue, 24 Jun 2003 19:43:45 +0000 (+0000) Subject: Permito mostrar tablas sin padre X-Git-Tag: svn_import~451 X-Git-Url: https://git.llucax.com/mecon/meconlib.git/commitdiff_plain/71864b3585eb6e98f858701544c969ff2979aa9a?ds=inline Permito mostrar tablas sin padre --- 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());