RE: Newbie: can't access a return value.
| From: | MEM | Date: | Sat, 01 Aug 2009 16:41:43 +0000 |
| Subject: | RE: Newbie: can't access a return value. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-296167@lists.php.net to get a copy of this message | ||
Solved. Forget to assigning the return value of the method to anything. :S
Sorry.
Márcio
> -----Original Message-----
> From: MEM [mailto:talofo@gmail.com]
> Sent: sábado, 1 de Agosto de 2009 17:13
> To: 'php-general@lists.php.net'
> Subject: Newbie: can't access a return value.
>
> 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