Código PHP:
<?php
Include('clases/adodb5/adodb.inc.php'); // cargo la clase
$DB= NewADOConnection('mysql');
$DB->connect('localhost', 'root', '','easypost');
$con_dic= NewADOConnection('mysql');
$con_dic->connect('localhost', 'root', '','diccio');
$rs = $DB->execute ("SELECT contenido FROM `posts` WHERE id=5");
echo $rs->fields['contenido']; // no imprime NADA
?>
Código PHP:
<?php
Include('clases/adodb5/adodb.inc.php'); // cargo la clase
$DB= NewADOConnection('mysql');
$DB->connect('localhost', 'root', '','easypost');
$rs = $DB->execute ("SELECT contenido FROM `posts` WHERE id=5");
echo $rs->fields['contenido']; // AHORA SI IMPRIME !!!!
$con_dic= NewADOConnection('mysql');
$con_dic->connect('localhost', 'root', '','diccio');
?>
Cita:
y la unica forma de solucionar es re-conectar justo antes de usar la conexion que habia perdido:Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysql error: [1146: Table 'diccio.posts' doesn't exist] in EXECUTE("SELECT contenido FROM `posts` WHERE id=5") ' in C:\xampp\htdocs\easypost\clases\adodb5\adodb-exceptions.inc.php:78 Stack trace: #0 C:\xampp\htdocs\easypost\clases\adodb5\adodb.inc.p hp(1043): adodb_throw('mysql', 'EXECUTE', 1146, 'Table 'diccio.p...', 'SELECT contenid...', false, Object(ADODB_mysql)) #1 C:\xampp\htdocs\easypost\clases\adodb5\adodb.inc.p hp(1018): ADOConnection->_Execute('SELECT contenid...', false) #2 C:\xampp\htdocs\easypost\testx.php(13): ADOConnection->Execute('SELECT contenid...') #3 {main} thrown in C:\xampp\htdocs\easypost\clases\adodb5\adodb-exceptions.inc.php on line 78
Código PHP:
$DB->connect('localhost', 'root', '','easypost');