Newbie: can't access a return value.
| From: | MEM | Date: | Sat, 01 Aug 2009 16:13:09 +0000 |
| Subject: | Newbie: can't access a return value. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-296164@lists.php.net to get a copy of this message | ||
Hi all,
When I do this:
$associacao_dao->listar($limit, $offset);
I can var_dump the correct $limit.
I can var_dump the correct $offset.
I CAN'T access the object that I was hoping to get, called $records.
After this, I was hoping to do var_dump($records); and see the stdClass
object.
Here is the listar method:
public function listar($limit=null, $offset=null)
{
$query_str="SELECT * FROM associacao";
$stmt = $this->_dbh->prepare($query_str . ' LIMIT ?, ?');
$stmt->bindParam(1, $limit, PDO::PARAM_INT);
$stmt->bindParam(2, $offset, PDO::PARAM_INT);
$stmt->execute();
$records = $stmt->fetchAll(PDO::FETCH_OBJ);
return $records;
}
Any help will be greatly appreciated.
Thanks a lot in advance,
Márcio