correção query aluno
This commit is contained in:
15
app/controllers/AlunoController.php
Normal file
15
app/controllers/AlunoController.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace app\controllers;
|
||||
|
||||
class AlunoController{
|
||||
public function index($params){
|
||||
$numero = $params->NR_LOGRADOURO;
|
||||
$Con = new Controller();
|
||||
$Alunos = $Con->getAlunos($numero);
|
||||
echo json_encode($Alunos);
|
||||
return json_encode($Alunos);
|
||||
}
|
||||
public function store(){
|
||||
var_dump('store do login');
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,27 @@ class Controller extends DBA{
|
||||
//caso o id não foi passado recebe essa mensagem
|
||||
die('informação incompleta...');
|
||||
}
|
||||
}
|
||||
public function getAlunos($NR_LOGRADOURO){
|
||||
//CRIADO PARA TESTE COM PARAMETRO
|
||||
if(!$NR_LOGRADOURO==''){
|
||||
$this->sql = "SELECT * FROM ALUNO WHERE NR_LOGRADOURO = ?";
|
||||
$this->stmt = self::$inst->prepare($this->sql);
|
||||
$this->stmt->bindValue(1,$NR_LOGRADOURO);
|
||||
$this->stmt->execute();
|
||||
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $this-> res;
|
||||
}else{
|
||||
//caso o id não foi passado recebe essa mensagem
|
||||
die('informação incompleta...');
|
||||
}
|
||||
//FUNCIONANDO PARA TODA A TABELA ALUNO
|
||||
//$this->sql = "SELECT * FROM ALUNO";
|
||||
//$this->stmt = self::$inst->prepare($this->sql);
|
||||
//$this->stmt -> execute();
|
||||
//$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
//print_r($this->res);
|
||||
//return $this->res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user