Created
February 10, 2012 10:20
-
-
Save flexd/1788532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>ENAME</td><td>JOB</td><td>DEPT</td><td>LOC</td></tr> | |
<?php | |
$sql= "select ENAME, JOB, DNAME, LOC from EMP AS E, DEPT AS D WHERE E.DEPTNO = D.DEPTNO"; | |
$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><td>'; | |
echo $rad[2]; | |
echo '</td><td>'; | |
echo $rad[3]; | |
echo '</td></tr>'; | |
} | |
?> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment