Buenas a todos...
Uso Mysql si, aquí adjunto la clase a la cual he echo referencia en el ejplo anterior... para que tengaís más información...
Por cierto, Patriarka he probado tu código y me da el mismo problema solo me general el 1º item y sus subitems pero los demas items no aparecen...
Código:
class Conectar {
private $sql;
/** SE CONECTA A LA BD Y COMPRUEBA QUE NO HAYA ERRORES **/
function __construct() {
global $link;
require_once(URLBASE . 'configuracion.php');
$link = mysqli_connect(SERVIDOR, USER, PASS, BD);
//$base = @mysqli_select_db ($link,BD);
try {
if (!$link) {
//die('ERROR DE CONEXIÓN (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
throw new Exception('ERROR DE CONEXIÓN',0);
}
// if (! $base){
//die ("ERROR AL CONECTAR CON LA BASE DE DATOS: ".mysqli_connect_error() );
// throw new Exception('ERROR AL CONECTAR CON LA BASE DE DATOS', 1);
// }
if (!mysqli_set_charset($link, "utf8")) {
//printf("Error cargando el conjunto de caracteres utf8: %s\n", mysqli_error($link));
throw new Exception('ERROR CARGANDO EL CONJUNTO DE CARACTERES', 2);
}
} catch(Exception $e) {
echo $e->getMessage() . '('. $e->getCode() . ')';
}
//echo 'Éxito... ' . mysqli_get_host_info($link) . "\n";
}
/** DEVUELVE LA CONSULTA DE LA BD, PARA TRATARLA CON FArray o Nrows **/
public function Query($sql) {
global $link;
global $res;
$this->sql = $sql;
$res = mysqli_query($link,$sql);
if (!$res) die('Error en la query: ' . mysqli_error($link));
return $res;
}
/** DEVUELVE EL ÚLTIMO ID GENERADO **/
public function UltId() {
global $link;
return mysqli_insert_id($link);
}
/** DEVUELVE LOS DATOS EN NOMBRE **/
public function FArray($consulta) {
global $res;
return mysqli_fetch_array($res, MYSQLI_ASSOC);
}
/** DEVUELVE LOS DATOS EN NUMEROS **/
public function Nrows($consulta) {
global $res;
return mysqli_num_rows($consulta);
}
/** CIERRA LA CONEXIÓN A LA BD Y LIMPIA LA MEMORIA **/
function Cerrar() {
global $link;
mysqli_close($link);
}
}
Un saludo y gracias!!!