Convert object from class to String

0

I'm trying to display the database query, but when I try to display it, the Object of class TDataTable could not be converted to string. error appears and pointing the error to the file frm_noticia.php ... What should I do to fix this error?

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];
    }
}
    
asked by anonymous 27.04.2016 / 16:29

1 answer

1

No frm_noticia.php you are echoing the result of the bank. You should pass mysql_fetch_assoc to get the data result .

To better understand a var_dump($view->obterIdLink())

    
27.04.2016 / 16:43