Re: Newbie: can't access a return value.
| From: | TG | Date: | Sat, 01 Aug 2009 16:42:07 +0000 |
| Subject: | Re: Newbie: can't access a return value. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-296166@lists.php.net to get a copy of this message | ||
Try:
$records = $associacao_dao->listar($limit, $offset);
-TG
----- Original Message -----
From: "MEM" <talofo@gmail.com>
To: <php-general@lists.php.net>
Date: Sat, 1 Aug 2009 17:13:09 +0100
Subject: [PHP] 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>