<?php
$db=mysql_connect("localhost", "rudersdalmarath", "rtCdxQaP");
mysql_select_db("rudersdalmarath", $db);

$sql = 'SELECT * FROM `Deltagere_24022008`';

function printTable($result)
{
 //get the first row in the table:
 if(!$row = mysql_fetch_assoc($result))
 {
  return false;
 }
 
 //set up the table:
 print("<table><tr>");
 
 //print the column names as table headers:
 foreach($row as $key=>$value)
 {
  print("<th>$key</th>");
 }
 print("</tr>");
 
 //loop through the table, printing
 //the field values in table cells:
 do
 {
  print("<tr>");
  foreach($row as $key=>$value)
  {
   print("<td>$value</td>");
  }
  print("</tr>");
 }
 while ($row = mysql_fetch_assoc($result));
 
 //close out the table:
 print("</tr></table>");
 return true;
}

//get the result and verify:    
if(!$result = mysql_query($sql))
{
   print ("Query could not be executed.\n");
}
$r = printTable($result);
//$r is a boolean that can be checked for the 
//success of printTable

?>