"); ?>

New PSU    '; print 'Back to search    '; ?> Log Off

"); echo "

Details for Wiener with serial $serial

"; $query = "SELECT * FROM psu WHERE serial='".$serial."'"; $result = pg_query($query) or die ("
ERROR - Couldn't execute wiener query: ".$query); $num = pg_num_rows($result); if($num != 0){ $WienerPars = array('location','status','MAC address','firmware','type'); $NumPars = sizeof($WienerPars); echo ''; echo Array_to_HTML_Table($WienerPars,$NumPars); while ($row = pg_fetch_array($result)){ extract($row); if(isset($loc_id)){ // Wiener is not in a LV bin; find out where... $locquery = "SELECT * FROM loc WHERE loc_id='".$loc_id."'"; $locres = pg_query($locquery) or die ("
ERROR - Couldn't execute location query: ".$locquery); $locnum = pg_num_rows($locres); if($locnum != 0){ $locrow = pg_fetch_array($locres); extract($locrow); $location = $name; } } $CurrentWie = array($location,$status,$mac_addr,$firmware,$typetxt[$type]); echo Array_to_HTML_Table($CurrentWie,$NumPars); $curr_loc = $location; $curr_stat = $status; $curr_pers = $person; $curr_time = $begin_time; } echo '
'; // close table echo "

Change its location and/or status:"; } else { print "
No matching Wieners found."; } // get the list of current locations: $locquery = "SELECT * FROM loc"; $locres = pg_query($locquery) or die ("
ERROR - Couldn't execute location query: ".$locquery); $idarray = array(); $locarray = array(); if(pg_num_rows($locres) != 0){ while ($locrow = pg_fetch_array($locres)){ extract($locrow); $idarray[] = $loc_id; $locarray[] = $name; } } else die ("
ERROR: cannot get the list of current locations."); $NumLoc = sizeof($locarray); print '
'; print 'Move it to:'; print ''; print ''; print '
and/or change its status to: '; print ' (any string*)'; print ''; print '
     '; print '  
'; echo '(*)However, please use the comment section below to add long descriptions of problems, special instructions, etc. - the status field is meant as a brief description.'; echo "

Comments:

"; $cmntquery = "SELECT cmnt_id FROM psu_cmnt_link WHERE serial='".$serial."'"; $cmntres = pg_query($cmntquery) or die ("
Cannot execute comment query: ".$cmntquery); if(pg_num_rows($cmntres) != 0){ $Comment = array('who','when','title','body'); $NumPars = sizeof($Comment); echo ''; echo Array_to_HTML_Table($Comment,$NumPars); while ($idrow = pg_fetch_array($cmntres)){ // loop over comments extract($idrow); $textquery = "SELECT * FROM comment WHERE cmnt_id=".$cmnt_id; $textres = pg_query($textquery) or die ("
Cannot execute comment text query: ".$textquery); if(pg_num_rows($textres) != 0){ $textrow = pg_fetch_array($textres); extract($textrow); $CurrentComment = array($person,$timestamp,$title,$body); echo Array_to_HTML_Table($CurrentComment,$NumPars); } else { $CurrentComment = array('-','-','-','-'); echo Array_to_HTML_Table($CurrentComment,$NumPars); } } // loop over comments echo '
'; // close table } else echo "there are no comments recorded for this wiener."; print '

Add a comment

'; echo "

History:

"; $histquery = "SELECT * FROM psu_old WHERE serial='".$serial."'"; $histres = pg_query($histquery) or die ("
ERROR - Couldn't execute history query: ".$histquery); $histnum = pg_num_rows($histres); if($histnum != 0){ $HistPars = array('location','status','person','begin','end'); $NumPars = sizeof($HistPars); echo ''; echo Array_to_HTML_Table($HistPars,$NumPars); while ($histrow = pg_fetch_array($histres)){ extract($histrow); if(isset($loc_id)){ $locq = "SELECT name FROM loc WHERE loc_id=".$loc_id; $resq = pg_query($locq) or die ("
ERROR - Couldn't execute location query: ".$locq); $rowq = pg_fetch_array($resq); extract($rowq); $location = $name; } else $location = $rack_id.'-'.$height; $HistVals = array($location,$status,$person,substr($begin_time,0,19),substr($end_time,0,19)); echo Array_to_HTML_Table($HistVals,$NumPars); } $CurrVals = array($curr_loc, $curr_stat, $curr_pers, substr($curr_time,0,19),'now'); echo Array_to_HTML_Table($CurrVals,$NumPars); echo '
'; // close table } else echo "there is no recorded history for this wiener."; print "
Back"; ?>