echo "<h3>No id given!</h3>";
}
- $query = sprintf ("SELECT component.name,component,screw.starttime,types.name as type "
+ $query = sprintf ("SELECT component.name,component,screw.starttime,screw.endtime,types.name as type "
."FROM screw,component,types "
."WHERE compound = %d AND component = component.id "
."AND screw.endtime IS NULL "
for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
$row = pg_fetch_array ($sth, $nr);
$start = explode (" ", $row['starttime']);
- printf ("<br>%s <a href=\"component.php3?id=%d\">%s</a> since %s",
- $row['type'], $row['component'], $row['name'], $start[0]);
+ if ($row['endtime']) {
+ $end = explode (" ", $row['endtime']);
+ printf ("<br>%s <a href=\"component.php3?id=%d\">%s</a> %s — %s",
+ $row['type'], $row['component'], $row['name'], $start[0], $end[0]);
+ } else {
+ printf ("<br>%s <a href=\"component.php3?id=%d\">%s</a> since %s",
+ $row['type'], $row['component'], $row['name'], $start[0]);
+ }
}