Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $dbname = "teste";
  7.  
  8. $conn = new mysqli ($servername,$username,$password,$dbname);
  9.  
  10. if ($conn->connect_error){
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13. $sql1 = "SELECT abbreviation,image FROM je";
  14.  
  15. $result1 = $conn->query($sql1);
  16. $i=0;
  17. $resultado = array(array(),array());
  18. while ($row = $result1->fetch_assoc()){
  19. $resultado[$i]["imagem"] = $row["image"];
  20. $resultado[$i]["abrevia"] = $row["abbreviation"];
  21. $i++;
  22. }
  23.  
  24.  
  25. echo json_encode($resultado);
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement