Hi JoeVB,
Have a look at SELECT in the PHP Manual
This is a bit of code I use from time to time. Bit untidy, but it should be a starting point.
//Make statements and connect to server
define (NL,"\n"); // makes the page think that .NL is /n for a new line
$sql_server = "localhost";
$sql_username = "username"; // put your username here
$sql_password = "password"; // put your password here
$sql_database = "databasename"; // put your database name here
global $sql_server;
global $sql_username;
global $sql_password;
global $sql_database;
$link = mysql_connect($sql_server, $sql_username, $sql_password)
or die("Could not connect : " . mysql_error());
mysql_select_db($sql_database) or die("Could not select database");
$query = mysql_query("SELECT * FROM atable");
print "<table>".NL; // start the table
//Display the rows of data in a table
while ($row = mysql_fetch_array($query, MYSQL_NUM))
{
//this loops for as many records as the query finds
print "<tr>".NL;
print "<td>" . $row[0] . "</h1></td>"; // 1st colum from db
print "<td>" . $row[1] . "</h1></td>"; // 2nd colum from db
print "<td>" . $row[2] . "</h1></td>"; // 3rd colum from db
print "<td>" . $row[3] . "</h1></td>"; // 4th colum from db
print "</tr>".NL;
?>
print "</table>".NL; // Finish table.
Hope this helps,
Neil.