Advertisement
Guest User

Untitled

a guest
Feb 21st, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "password";
  6. $dbname = "Intel";
  7.  
  8. $conn = mysqli_connect($servername, $username, $password, $dbname);
  9.  
  10. if (!$conn) {
  11. echo "Error: Unable to connect to MySQL." . PHP_EOL;
  12. echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
  13. echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
  14. exit;
  15. }
  16.  
  17. $pos_query = "SELECT * FROM posData ";
  18. $pos_result = mysqli_query($conn, $pos_query);
  19.  
  20. $pos_data = array();
  21. while($row = mysqli_fetch_array($pos_result)) {
  22. $pos_data[] = $row;
  23. }
  24.  
  25.  
  26. echo "<pre>";
  27. print_r($pos_data);
  28. echo "</pre>";
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement