Cambia
Código PHP:
<html>
<head><title>listado</title></head>
<body>
<?
mysql_connect("localhost","root","");
$result=mysql_db_query("agenda","select * from amigos");?>
<table>
<tr><td>nombre</td><td>telefono</td></tr><?
while ($row=mysql_fetch_array($result)){
echo '<tr><td>'.$row["nombre"].'</td>';
echo '<td>'.$row["telefono"].'</td>';}
mysql_free_result($result)?>
</table>
</body>
</html>
Por
Código PHP:
<html>
<head><title>listado</title></head>
<body>
<?
$conectar = mysql_connect("localhost","root","");
mysql_select_db("agenda", $conectar);
$result=mysql_query("select * from amigos", $conectar);?>
<table>
<tr><td>nombre</td><td>telefono</td></tr><?
while ($row=mysql_fetch_array($result)){
echo '<tr><td>'.$row["nombre"].'</td>';
echo '<td>'.$row["telefono"].'</td>';}
mysql_free_result($result)?>
</table>
</body>
</html>
Y luego prueba a ver si te funciona..