0
I’m trying to display the database query, but when trying to display the error appears Object of class TDataTable could not be converted to string.
and pointing the error to the file frm_noticia.php
... What must I do to fix this mistake ?
Obs:. Ordem de Processo (controller_noticia > view_noticia > frm_noticia)
controller_noticia.php
function obterIdLink() {
$sql = "SELECT MAX(noticia_id) FROM noticia";
$result = $this->getConexao()->executeQuery($sql);
if($result != null) {
return $result;
} else {
return null;
}
}
view_noticia.php
function obterIdLink() {
return $this->getController()->obterIdLink();
}
frm_noticia.php
echo $view->obterIdLink();
Tdatatable.php
class TDataTable {
private $FRows = array();
function __construct ( $resource ) {
switch(DB_TYPE){
case "MYSQL":
while ($row = mysql_fetch_assoc($resource)) {
$this->FRows[] = new TDataRow($row);
}
break;
}
}
function Rows() {
return $this->FRows;
}
function RowCount() {
return count($this->FRows);
}
function bind($object, $line) {
throw new Exception("Nao implementado");
}
function getRow($pos) {
return $this->FRows[$pos];
}
}
You are trying to echo a Resource which is the result of the query in the database. Hence the error.
– user28595
@Diegof I’m a beginner in PHP, I don’t understand what you mean... if it’s not too much trouble you could explain it to me better ?
– Ikaro Sales
Enter the code of
executeQuery()
– rray
@rray if you observe you will see that already exists in Arq. controller_noticia.php
– Ikaro Sales
Does this framework have a manual? it seems to have a very strict flow
– rray
@rray Actually it does not have that is a part of the company design code where I work, and like the software is all disorganized
– Ikaro Sales