X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/4c80b40da97be7e87af6a6e421677122e1e581f9..71864b3585eb6e98f858701544c969ff2979aa9a:/lib/MECON/HTML/Arbol/ArbolDB.php 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());