Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <html>
  2. <head><title>Grab all users & email addresses from MySQL </title></head>
  3. <body bgcolor="#FFFFFF">
  4.  
  5. <?
  6. /* declare some relevant variables */
  7. $DBhost = "localhost";
  8. $DBuser = "";
  9. $DBpass = "";
  10. $DBName = "";
  11. $table = ""; // not sure if this is needed since we run a sqlquery below
  12.  
  13. mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
  14. @mysql_select_db("$DBName") or die("Unable to select database $DBName");
  15.  
  16. $query = "SELECT * FROM GOMN ORDER by production, construction, research DESC LIMIT 10";
  17.  
  18. // execute query
  19. $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
  20.  
  21. // see if any rows were returned
  22. if (mysql_num_rows($result) > 0) {
  23. // yes
  24. // print them one after another
  25. echo "<table cellpadding=10 border=1>";
  26. while($row = mysql_fetch_row($result)) {
  27. echo "<table width=\"100%\" style='table-layout:fixed'>\n";
  28. echo " <tr>\n";
  29. echo " <td>\n";
  30. echo " <table width=183 style='table-layout:fixed'>\n";
  31. echo " <tr>\n";
  32. echo " <td>".$row[2]."</td>\n";
  33. echo " <td>".$row[32]."</td>\n";
  34. echo " </tr>\n";
  35. echo " </table>\n";
  36. echo " </td>\n";
  37. echo " <td>\n";
  38. echo " <table width=183 style='table-layout:fixed'>\n";
  39. echo " <tr>\n";
  40. echo " <td>".$row[2]."</td>\n";
  41. echo " <td>".$row[33]."</td>\n";
  42. echo " </tr>\n";
  43. echo " </table>\n";
  44. echo " </td>\n";
  45. echo " <td>\n";
  46. echo " <table width=183 style='table-layout:fixed'>\n";
  47. echo " <tr>\n";
  48. echo " <td>".$row[2]."</td>\n";
  49. echo " <td>".$row[34]."</td>\n";
  50. echo " </tr>\n";
  51. echo " </table>\n";
  52. echo " </td>\n";
  53. echo " </tr>\n";
  54. }
  55. echo "</table>\n";
  56. }
  57. else {
  58. // no
  59. // print status message
  60. echo "No rows found!";
  61. }
  62. ?>
  63. </BODY></HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement