try looking in the manual (http://www.php.net/manual/)
from the manual...
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("could not connect");
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf ("ID: %s Name: %s", $row[0], $row[1]);
}
mysql_free_result($result);
?>