Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. $username = "x";
  4. $password = "x";
  5. $hostname = "x";
  6.  
  7. //connection to the database
  8. $dbhandle = mysql_connect($hostname, $username, $password)
  9.  or die("Unable to connect to MySQL");
  10. echo "Connected to MySQL<br>";
  11.  
  12. //select a database to work with
  13. $selected = mysql_select_db("hw_terranova",$dbhandle)
  14.   or die("Could not select database");
  15.  
  16. //execute the SQL query and return records
  17. $result = mysql_query("SELECT coordinates FROM playermovement");
  18.  
  19.  
  20. //fetch tha data from the database
  21. while ($row = mysql_fetch_array($result)) {
  22.  
  23.     $coords = explode("," $row["coordinates"]);
  24.  
  25. if (count($coords) == 3) echo trim($coords[0]). ",". trim($coords[2]) .", 1, 10/255 ". ;
  26.  
  27. }
  28.  
  29. //close the connection
  30. mysql_close($dbhandle);
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement