I have a problem with the return of the information I perform with PDO_INFORMIX
, then I show you my case:
1. Database:
INFORMIX
2. Schema:
-Table: cartas
-Campos:
|id | codigo | titulo |contenido |
---------------------------------------------
| SERIAL | INTEGER|VARCHAR(15) | TEXT |
3. Contents of the table:
-id: 1
-code: 25463985
-title: Requisitos Especiales
-content:
<div><strong>DOCUMENTOS PARA EL AÑO 2018</strong></div>
<div> </div>
<ul>
<li><u>DOCUMENTOS NECESARIOS PARA REALIZAR EL TRAMITE:</u></li></ul>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asddeDetrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> </div>
<ul>
<li><u>DOCUMENTOS PARA ASDASDASDASD:</u></li></ul>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asddeDetrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asddeDetrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div><div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde<br></div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asddeDetrffghfjh Fasdasdasd as Iasdasdasdasd asdde</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asddeDetrffghfjh Fasdasdasd as Iasdasdasdasd asddeDetrffghfjh Fasdasdasd as Iasdasdasdasd asdde</div>
<div> *Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde.</div>
<div> </div>
<div> </div>
<div> </div>
<div><strong>MAYORES INFORMES</strong></div>
<div>Carrera Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde </div>
<div>Detrffghfjh Fasdasdasd as Iasdasdasdasd asdde</div>
I am making the connection to the Database by means of PDO_INFORMIX
in the following way:
CONNECTION:
$conexion = new PDO("informix:host=127.0.0.1;service=sqldesarrol;database=bdtest; server=online_shm;protocol=onsoctcp;EnableScrollableCursors=1;", "userTest", "PassTest");
$conexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
INQUIRY:
$sql = "SELECT * FROM cartas";
$prep = $conexion->prepare($sql);
$prep->execute();
$result = $prep->fetchAll(PDO::FETCH_ASSOC);
var_dump($result);
I realize a var_dump
to see the information returned and I have the following result.
RESULT:
array(1) {
[0]=>
array(5) {
["ID"]=>
string(1) "1"
["CODIGO"]=>
string(8) "25463985"
["TITULO"]=>
string(21) "Requisitos Especiales"
["CONTENIDO"]=>
resource(2) of type (stream)
}
}
I do not understand why I return the content of the content field that way.
WHAT HAS BEEN TESTED:
if(is_resource($result[0]['CONTENIDO']))
{
echo get_resource_type($result[0]['CONTENIDO']);
}
Returns: stream
Based on that test I used the function get_resources
but I get the following error:
<b>Warning</b>: get_resources() expects parameter 1 to be string, resource given in <b>C:\....
What I'm most curious about is that if I do the following:
echo $result[0]['EDUFORCONTEX'];
It gives me as a result:
Resource id #2