Skip to content

Instantly share code, notes, and snippets.

@flexd
Created February 9, 2012 12:56
Show Gist options
  • Save flexd/1779826 to your computer and use it in GitHub Desktop.
Save flexd/1779826 to your computer and use it in GitHub Desktop.
<html>
<head></head>
<body>
<?php
mysql_connect("localhost","kristoffer","dbpass") or die("Kan ikke koble til db");
mysql_select_db("kristoffer") or die("Kan ikke koble til");
?>
<table width="50%" border="1"><tr><td>Navn</td><td>Alder</td></tr>
<?php
$sql= "select * from person" ;
$resultat=mysql_query($sql);
$antall=mysql_num_rows($resultat);
for ($i=0; $i <$antall; $i++){
$rad=mysql_fetch_row($resultat);
echo '<tr><td>';
echo $rad[0];
echo '</td><td>';
echo $rad[1];
echo '</td></tr>';
}
?>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment