Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<?php
function subordinates ($superior, $right)
{
global $link;
$query = "SELECT * FROM personnel WHERE id = $superior";
$resource1 = mysql_query ($query, $link);
if ($resource1 !== FALSE)
{
$result = mysql_fetch_object ($resource1);
print "\n<tr>";
if ($right > 1)
{
print "\n\t<td colspan=";
print $right - 1;
print '> </td>';
}
print "\n\t<td>\n";
print "\t\t<a href=\"/foo/update_person_data.php?id=$result->id\">\n";
print "\t\t\t$result->name_first $result->name_last\n";
print "\t\t</a><br>\n";
print "\t\t$result->role\n";
print "\t</td>\n</tr>\n";
$query = "SELECT id FROM personnel WHERE reports_to = $superior ORDER BY name_last, name_first";
$resource2 = mysql_query ($query, $link);
if ($resource2 !== FALSE)
{
while (list ($id) = mysql_fetch_array ($resource2))
{
subordinates ($id, $right + 1);
}
}
}
}
$link = mysql_connect ('localhost', 'test', 'test') or die ('Could not connect: '.mysql_error($link));
mysql_selectdb ('test', $link) or die ('Could not select database :'.mysql_error($link));
print "<html><body><table border=0>\n";
subordinates (1, 1);
print "\n</table></body></html>";
?>