Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><title>Grab all users & email addresses from MySQL </title></head>
- <body bgcolor="#FFFFFF">
- <?
- /* declare some relevant variables */
- $DBhost = "localhost";
- $DBuser = "";
- $DBpass = "";
- $DBName = "";
- $table = ""; // not sure if this is needed since we run a sqlquery below
- mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
- @mysql_select_db("$DBName") or die("Unable to select database $DBName");
- $query = "SELECT * FROM GOMN ORDER by production, construction, research DESC LIMIT 10";
- // execute query
- $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
- // see if any rows were returned
- if (mysql_num_rows($result) > 0) {
- // yes
- // print them one after another
- echo "<table cellpadding=10 border=1>";
- while($row = mysql_fetch_row($result)) {
- echo "<table width=\"100%\" style='table-layout:fixed'>\n";
- echo " <tr>\n";
- echo " <td>\n";
- echo " <table width=183 style='table-layout:fixed'>\n";
- echo " <tr>\n";
- echo " <td>".$row[2]."</td>\n";
- echo " <td>".$row[32]."</td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo " <td>\n";
- echo " <table width=183 style='table-layout:fixed'>\n";
- echo " <tr>\n";
- echo " <td>".$row[2]."</td>\n";
- echo " <td>".$row[33]."</td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo " <td>\n";
- echo " <table width=183 style='table-layout:fixed'>\n";
- echo " <tr>\n";
- echo " <td>".$row[2]."</td>\n";
- echo " <td>".$row[34]."</td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo " </tr>\n";
- }
- echo "</table>\n";
- }
- else {
- // no
- // print status message
- echo "No rows found!";
- }
- ?>
- </BODY></HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement