<?php
//I connect to what database server
$con = mysql_connect("localhost","user","password");
//Am I connected ?
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// I select the database from within the database server
mysql_select_db("my_db", $con);

// I create a query on the table i'm interested in and
// I put the record set into a variable $result
$result = mysql_query("SELECT * FROM Persons");

// I make a loop to read my recordset and format the output in a html table

echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";

// the loop will end when all records are fetched from the $result recordset
//$row becomes an array with an index made of the table fields.
while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['FirstName'] . "</td>";
  echo "<td>" . $row['LastName'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

// I don't need the connection anymore
mysql_close($con);
?>