criação da conexão com o banco mobile
This commit is contained in:
@@ -27,12 +27,12 @@ class Controller extends DBA{
|
||||
die('informação incompleta...');
|
||||
}
|
||||
}
|
||||
public function getAlunos($NR_LOGRADOURO){
|
||||
public function getAlunos($NOME){
|
||||
//CRIADO PARA TESTE COM PARAMETRO
|
||||
if(!$NR_LOGRADOURO==''){
|
||||
$this->sql = "SELECT * FROM ALUNO WHERE NR_LOGRADOURO = ?";
|
||||
if(!$NOME==''){
|
||||
$this->sql = "SELECT * FROM ALUNO WHERE NO_ALUNO LIKE ?";
|
||||
$this->stmt = self::$inst->prepare($this->sql);
|
||||
$this->stmt->bindValue(1,$NR_LOGRADOURO);
|
||||
$this->stmt->bindValue(1,"%".$NOME."%");
|
||||
$this->stmt->execute();
|
||||
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $this-> res;
|
||||
@@ -47,6 +47,13 @@ class Controller extends DBA{
|
||||
//$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
//print_r($this->res);
|
||||
//return $this->res;
|
||||
}
|
||||
public function getPais(){
|
||||
$this->sql = "SELECT * FROM usuarios";
|
||||
$this->stmt = self::$inst->prepare($this->sql);
|
||||
$this->stmt->execute();
|
||||
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $this-> res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +64,10 @@ class DBA{
|
||||
function __construct(){
|
||||
try{
|
||||
if(self::$inst === null){
|
||||
self::$inst = new \PDO(STR_BD,USUARIO,SENHA);
|
||||
//FIREBIRD
|
||||
//self::$inst = new \PDO(STR_BD,USUARIO,SENHA);
|
||||
//MARIADB
|
||||
self::$inst = new \PDO("mysql:dbname=controledb;host=localhost;charset=utf8",'root','');
|
||||
}
|
||||
//retorna a instancia com sucesso
|
||||
//echo "Connected successfully";
|
||||
|
||||
Reference in New Issue
Block a user