Guest User

Untitled

a guest
Jul 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. $conn = mysql_connect('localhost','root','') or die('Wrong username or password; cant connect');
  3. $db_select = mysql_select_db('bincomphptest', $conn) or die('cant find database');
  4. $sql = "SELECT party_abbreviation, SUM(party_score) FROM announced_lga_results GROUP BY party_abbreviation";
  5. $query = mysql_query($sql) or die ('cant run query');
  6. $data = "mysql_fetch_assoc($query)";
  7. ?>
  8. <html>
  9. <head><title> RESULTS </title></head>
  10. <body>
  11. <h1><font color='blue'>This page displays the summed total result </font></h1>
  12. <h3><strong>Status:</strong></h3>Query was successful.
  13. <br>
  14. <br>
  15.  
  16.  
  17. <select name="sl1">
  18. <?php
  19. do {
  20. ?>
  21. <option value="">
  22. <?php echo "Total:" .$data['party_abbreviation']. " = " .$data['SUM(party_score)']; ?>
  23. </option>
  24. <?php
  25. } while($data = mysql_fetch_assoc($query));
  26. ?>
  27. </select>
  28.  
  29.  
  30.  
  31.  
  32.  
  33. </table>
  34. </body>
  35. </html>
Add Comment
Please, Sign In to add comment