note 97727 deleted from function.array-push by danbrown
| From: | danbrown@php.net | Date: | Wed, 05 May 2010 14:38:20 +0000 |
| Subject: | note 97727 deleted from function.array-push by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168977@lists.php.net to get a copy of this message | ||
Note Submitter: DanielC dot -daniel dot costa dot silva at gmail dot com
----
public function listar(){
try{
$this->stmt = $this->conexao();
$rs = $this->stmt->prepare("SELECT idCategoria,categoria
FROM categoria c
ORDER BY categoria");
$rs->execute();
if($rs->rowCount() > 0){
$list = array();
while($row = $rs->fetch(PDO::FETCH_OBJ)){
$categoria = new Categoria();
$categoria->setIdCategoria($row->idCategoria);
$categoria->setCategoria($row->categoria);
array_push($list, $categoria);
}
return $list;
}
}catch (PDOException $e){
echo $e->getMessage();
}
}