1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?php
// Make a MySQL Connection
include('config.php');
mysql_connect($dbhost,$dbuname,$dbpass) or die(mysql_error());
mysql_select_db("name") or die(mysql_error());
// Get all the data from the "Name" table
$result = mysql_query("SELECT * FROM Name")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Mean</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['name'];
echo "</td><td>";
echo $row['mean'];
echo "</td></tr>";
}
echo "</table>";
?> |
Partager