SHARE
TWEET

Untitled

a guest May 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.    try
  4.    {
  5.       $pdo = new PDO('mysql:host=localhost;dbname=SE-1', 'root', '');
  6.    }
  7.    catch(PDOException $e)
  8.    {
  9.       echo 'Połączenie nie mogło zostać utworzone: ' . $e->getMessage();
  10.    }
  11.  
  12.  
  13. $sql = "SELECT * FROM users";
  14.  
  15. // $data = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
  16.  
  17. $data = $pdo->query($sql);
  18. $data = $data->fetchAll(PDO::FETCH_ASSOC);
  19. var_dump($data);
  20. //header("content-type:application/json");
  21. echo json_encode($data);
  22.  
  23. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top