documentation/Reference Code/Wedge/backend/lib/table_departments.php.ref
<?php
require_once($_SERVER["DOCUMENT_ROOT"]."/define.conf");
function get_departments($backoffice) {
$link=mysql_connect($_SESSION["mServer"], $_SESSION["mUser"], $_SESSION["mPass"]);
if ($link) {
$query='SELECT `dept_no`, `dept_name` FROM `is4c_op`.`departments` ORDER BY `dept_no`';
$result=mysql_query($query, $link);
if ($result) {
if (mysql_num_rows($result)==0) {
array_push($backoffice['status'], 'No departments 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');
}
}
?>