arthurd2

DB2Json

Jul 12th, 2023
1,061
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1. $mysqli = new mysqli("db","usuario","senha","banco-de-dados");
  2.  
  3. $resultado = $mysqli->query("show databases;");
  4.  
  5. while ($linha = $resultado->fetch_assoc()) $dados[] = $linha;
  6.  
  7. header('Content-Type: application/json');
  8. echo json_encode($dados);
Advertisement
Add Comment
Please, Sign In to add comment