{
$section = $usersection;
}
- if (!strlen ($section)) {
- die ("Error: Section required.");
- }
+ if (!strlen ($section)) { die ("Error: Section required."); }
+ if (!strlen ($location)) { die ("Error: Location required."); }
+ if (!strlen ($title)) { die ("Error: Title required."); }
if ($id == 0) {
$query = sprintf("INSERT INTO job (title, location, description, priority, comment, section) " .
" VALUES ('%s', '%s', '%s', %d, '%s', '%s')",
- addslashes($title), addslashes($location), addslashes($description),
- $priority, addslashes($comment), addslashes($section));
+ addslashes($title),
+ addslashes($location),
+ addslashes($description),
+ $priority,
+ addslashes($comment),
+ addslashes($section));
} else {
$query = sprintf("UPDATE job SET title = '%s', location = '%s', description = '%s', " .
" priority = %d, comment = '%s', section = '%s' WHERE id = %d",
- addslashes($title), addslashes($location), addslashes($description),
- $priority, addslashes($comment), addslashes($section), $id);
+ addslashes($title),
+ addslashes($location),
+ addslashes($description),
+ $priority,
+ addslashes($comment),
+ addslashes($section),
+ $id);
}
- $sth = pg_exec($dbh, $query) or die ("Database Query.");
+ $sth = pg_exec($dbh, $query) or die ("Cannot add or edit this job.");
if ($id == 0) {
$query = sprintf ("SELECT id FROM job WHERE oid = %d", pg_getlastoid ($sth));