-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetDatabaseName.php
More file actions
32 lines (22 loc) · 865 Bytes
/
getDatabaseName.php
File metadata and controls
32 lines (22 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
//////pegando nome de uma conexão PDO e transformando ela em xml para ser lida como texto, retorno TEXTO
/////utilizando uma conexão PDO
public function getDatabase(){
$resultado = $this->conexao->query("SELECT database();");
//echo $resultado;
$dados = $resultado->fetchAll(PDO::FETCH_OBJ);
if(count($dados) > 0){
foreach($dados as $linha){
$dados2 = $linha;
//echo "<option selected value='$linhaApi->email'>$linha->et_nome</option>";
}
}
///
//$dados3 = var_dump($dados);
// $dados4 = $dados["database()"];
// return $dados3;
$xml = json_decode(json_encode($dados),true);
$xml2 = $xml[0]["database()"];
return $xml2;
}
?>