$username="user";
$password="password";
$database="company";
mysql_connect("host.domain.edu",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT dnumber,dname FROM department order by dnumber";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
Departments of Company
Department Number |
Department Name |
$i=0;
while ($i < $num) {
$dno=mysql_result($result,$i,"dnumber");
$dname=mysql_result($result,$i,"dname");
?>
echo $dno; ?> |
echo $dname; ?> |
$i++;
}
?>
Return to main page