0
I am running in HTML with PHP an ERP Project that via XAMPP the file Buscacurriculum.php
will bring on screen the image and data of the employee.
Mesangem:
Fatal error: Uncaught Error: Call to a member function query() on resource "C:\xampp\..." StackTrace: #0 {main}
PHP code
<?php
$HndCon=pg_connect("host=localhost port=5432 dbname=cyberdynedb user=tst password=minhasenha");
pg_exec($HndCon,"BEGIN");
$sql = "SELECT * FROM public.fotos";
$sth = $HndCon->query($sql);
$result=pg_fetch_array($sth);
echo '<img src="data:image/jpeg;base64,'.base64_encode( $result['image'] ).'"/>';
?>
Table photos contains the columns id
, foto
, oid
. There are registered data (1, bynarydata, 33034)
.
The line $sth = $HndCon->query($sql);
i saw in another post here in Stack and helped in the execution but the error persists.
The error message seems incomplete to me. Is that right? Try [Edit] the question to provide more details.
– Luiz Felipe
Among the fields you have reported that exist in your table there is no field :
image
– anonimo
@Luizfelipe Fatal error: Uncaught Error: Call to a Member Function query() on Resource "C: xampp htdocs enterprise Buscainterna.php" Stacktrace: #0 {main} thrown in C: xampp htdocs enterprise Buscainterna.php on line 37. Line 37 is: $sth = $Hndcon->query($sql);
– MisterSilva-Dev.Suporte
@anonimo. Changing to photos error persists. I believe not to be this, I do not know if it can be some event remaining in Boolean logic with Vector, I follow without answer.
– MisterSilva-Dev.Suporte
What type of data is used for the field
foto
since Postgresql does not have the BLOB data type?– anonimo
@anonimo I registered the JPG format of the root directory C: Temp and populated the database with this data. I’m trying to analyze is some boolean condition by string array. But nothing so far.
– MisterSilva-Dev.Suporte