<?
$username="brukernavn";
$password="passord";
$database="din_database";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Kunne ikke koble til databasen");
$query="SELECT * FROM persontabell";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b>Personer i databasen:</b><br><br>";
$i=0;
while ($i < $num) {
$firstname=mysql_result($result,$i,"first");
$lastname=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$cellphone=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
echo "<b>$firstname $lastname</b><br>Telefon: $phone<br>Mobil: $cellphone<br>Fax: $fax<br>Epost: $email<br>Webside: $web<br><br>";
$i++;
}
?>
|