documentation/Reference Code/Wedge/backend/lib/table_subdepts.php.ref
<?php
require_once($_SERVER["DOCUMENT_ROOT"]."/define.conf");
function get_subdepartments($backoffice) {
$link=mysql_connect($_SESSION["mServer"], $_SESSION["mUser"], $_SESSION["mPass"]);
if ($link) {
$query='SELECT `subdept_no`, `subdept_name` FROM `is4c_op`.`subdepts` ORDER BY `subdept_no`';
$result=mysql_query($query, $link);
if ($result) {
if (mysql_num_rows($result)==0) {
array_push($backoffice['status'], 'No subdepartments found...');
return false;
} else {
return $result;
}
} else {
array_push($backoffice['status'], 'Error with MySQL query: '.mysql_error($link));
}
} else {
array_push($backoffice['status'], 'Error connecting to MySQL');
}
}
?>