Location: PHPKode > projects > PHPdir > phpdir/admin/list.php
<?
include ('dbkey.php');
include ('queries.php');
include ('functions.php');
include ('head.admin.php');
?>
<td valign="top">
  <table width="100%" border="0">
    <tr>
      <td valign="top" colspan="3">
<?
/* List departments in DB and build SELECT array */

$link_dept = mysql_connect($dbhost,$dbuser,$dbpass)
    or die("Could not connect to the database");
mysql_select_db($dbname,$link_dept)
    or die("Could not select the database");
$result_dept = mysql_query($select_dept_list);

while ( $a_row = mysql_fetch_array( $result_dept ))
    {
        if ( $a_row[serial] == $dept ) {
            print "<p class=Highlight>All contacts in <b>\"$a_row[department]\"</b></p>";
        }
    }
?>
	  </td>
	</tr>
    <tr>
	  <td class=TinyText valign="top"><b>Name</b></td>
	  <td class=TinyText valign="top"><b>Title</b></td>
	  <td class=TinyText valign="top"><b>Phone</b></td>
	  <td>&nbsp;</td>
	</tr>
<?
/* List the entries in the selected department */

$link_list = mysql_connect($dbhost, $dbuser, $dbpass)
    or die("Could not connect to the database");
 mysql_select_db($dbname, $link_list)
    or die("Could not select the database");
$result_list = mysql_query($select_dept_contacts);

while ( $a_row = mysql_fetch_array( $result_list ))
    {
     print "<tr><td valign=\"top\">$a_row[lastname], $a_row[firstname]</td>
            <td valign=\"top\">$a_row[title]</td>
            <td valign=\"top\">$a_row[phone]</td>
            <td><a href=\"$adm_path/edit.php?action=list&personid=$a_row[personid]\">
            <img src=\"$img_path/button_edit.gif\" border=\"0\"></a></td></tr>";
    }
?>
        </table>
      </td>
    </tr>
  </table>
</td>
<?
include ('footer.php');
?>
Return current item: PHPdir