Prueba con algo asi:
Código PHP:
<?php
$link = mysql_connect('localhost', 'usuario', 'clave');
if (!$link) {
die('Could not connect to MySQL server: ' . mysql_error());
}
$dbname = 'db';
$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
die('Could not set $dbname: ' . mysql_error());
}
$query = "select nombre,telefono from agenda ";
$res = mysql_query ($query);
echo "<table> \n"
."<tr>\n"
."<th>Nombre</th>\n"
."<th>Telefono</th>\n"
."</tr>\n";
while ($row = mysql_fetch_row ($res))
{
echo "<tr>\n"
."<td>".$row['nombre']. "</td>\n"
."<td>".$row['telefono']. "</td>\n"
."</tr> \n";
}
echo "</table> \n";
?>