Advertisement
Guest User

Untitled

a guest
May 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. @@ ini_set('display_errors', 1);
  4.  
  5. //Include database connection details
  6. require_once('../loggedIN/config.php');
  7.  
  8. //Connect to mysql server
  9. $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  10. if(!$link) {
  11.     die('Failed to connect to server: ' . mysql_error());
  12. }
  13.    
  14. //Select database
  15. $db = mysql_select_db(DB_DATABASE);
  16. if(!$db) {
  17.     die("Unable to select database");
  18. }
  19.  
  20. $count = 1;
  21.  
  22. function mixed() {
  23.  
  24.     $qry =  "SELECT firstName, lastName, avgPPT " .
  25.             "FROM bowlers " .
  26.             "ORDER BY avgPPT ASC " .
  27.             "LIMIT 0, 10";
  28.     $result = mysql_query($qry);
  29.     if (!$result) {
  30.         die("FAIL!");
  31.     }
  32.    
  33.     while($row = mysql_fetch_array($result)) {
  34.         echo "<tr>";
  35.         echo "<td>" . $count . "</td>";
  36.         echo "<td>" . $row['firstName'] . "</td>";
  37.         echo "<td>" . $row['lastName'] . "</td>";
  38.         echo "<td>" . $row['avgPPT'] . "</td>";
  39.         echo "</tr>";
  40.         $count++;
  41.     }
  42.     return;
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement