jhylands

board.php

May 20th, 2013
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <table border="1" class="a1" style=""><tr>
  2. <?php
  3. //Draw the map
  4. //include drawing.php so to draw each property
  5. include 'drawing.php';
  6. // Create connection to database
  7. include 'sql.php';
  8. //use $i as a counter, for 0<$i<=10{first line} for 10<$i<=28{[($i-10)/2]th line} for 28<$i<38{10th line)
  9. $i=0;
  10. //Create an an array of all the data needed from the database
  11. $prop = array();
  12. //SQL Table Property
  13. $result = mysqli_query($con,"SELECT * FROM Properties");
  14. while($row = mysqli_fetch_array($result))
  15.   {
  16.     $prop[$i]['Name'] = $row['Name'];
  17.     $prop[$i]['Band'] = $row['Band'];
  18.     $prop[$i]['Price'] = $row['Price'];
  19.     //increase the counter
  20.     $i++;
  21.   }
  22. for($i=0;$i<11;$i++){
  23.     drawProperty($i,$prop[$i]['Name'],$prop[$i]['Band']);
  24. }
  25. echo "</tr><tr>";
  26. drawProperty(39,$prop[39]['Name'],$prop[39]['Band']); //mayfair
  27. //middle needs putting in
  28. echo '<td id="the" colspan="9" rowspan="9">';
  29. echo '<h1>Loading please wait...</h1>';
  30. echo '</td>';
  31. drawProperty(11,$prop[11]['Name'],$prop[11]['Band']);//pall mall
  32. echo "</tr><tr>";
  33. //sides of the map
  34. for($r=0;$r<=7;$r++){
  35.     $i = 38 - $r;
  36.     drawProperty($i,$prop[$i]['Name'],$prop[$i]['Band']);
  37.     $i = 12 + $r;
  38.     drawProperty($i,$prop[$i]['Name'],$prop[$i]['Band']);
  39.     echo "</tr><tr>";
  40. }
  41. echo "</tr><tr>";
  42. //bottom of the map
  43. for($i=30;$i>19;$i++){
  44.     drawProperty($i,$prop[$i]['Name'],$prop[$i]['Band']);
  45.         $i-=2;
  46. }
  47. //close connection to db
  48. mysqli_close($con);
  49. ?>
  50. </tr></table>
Advertisement
Add Comment
Please, Sign In to add comment