Here is the part that works you can see results at http://www.bjrh.org/HRjobs/results.php:
Code: Select all
<?php
require_once('positions_inc_fns.php');
session_start();
$db_host = '******';
$db_user = '*****';
$db_pass = '*****';
$db_name = '*****';
$db_table = 'positions' . 'category' . 'departments';
$conn = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name,$conn);
// ---- END CONFIGURATIONS ------------------------------------------//
$query = "SELECT * FROM category ORDER BY catID";
$result = mysql_query( $query );
if ( $row = mysql_fetch_assoc( $result ) ) {
do {
extract( $row );
$subquery = "SELECT * FROM positions WHERE catID=$catID ORDER BY title";
$subresult = mysql_query( $subquery );
if ( $subrow = mysql_fetch_assoc( $subresult ) ) {
echo "<img src="../images/bullet.gif"><font face="Verdana" size="2">" .$category."</font><br>";
do {
extract( $subrow );
echo "<font face="Verdana" size="1"><a href="show_positions.php?posID=$posID">$title - $depID</a></font><br>";
}
while( $subrow = mysql_fetch_assoc( $subresult ) );
}
}
while( $row = mysql_fetch_assoc( $result ) );
}
else {
echo "No category available";
}
?>I have used the following on another page, which works fine, but I am not sure where and how to call this function in the code above:
Code: Select all
<?php
$dep_array=get_departments();
foreach ($dep_array as $thisdepartments)
{
if ($thisdepartments['depID'] == $positions['depID'])
echo '<I>' . $thisdepartments['departments'] . ' Department</I><br><br>';
}
?>Thanks,