Hallo,
ich brauch mal wieder eure Hilfe.
Ich übergeben $uid, dieser Wert sollte eigentlich in fk_abteilung gespeichert werden. Nun hab ich keinen blassen Schimmer, was ich falsch gemacht habe, den es funktioniert nicht.
Vielleicht kann mir einer von euch sagen, was falsch ist.
ich brauch mal wieder eure Hilfe.
Ich übergeben $uid, dieser Wert sollte eigentlich in fk_abteilung gespeichert werden. Nun hab ich keinen blassen Schimmer, was ich falsch gemacht habe, den es funktioniert nicht.
Vielleicht kann mir einer von euch sagen, was falsch ist.
PHP-Code:
<?
function buildlist ($assetID, $uid, $read_only) {
If ($assetID != "spare") {
$strCondition = "p.fk_asset=$assetID";
If (!$uid) {
$strPeriph = "Peripherals associated with this spare part:";
} Else {
$strSQL = "SELECT name, id_abteilung FROM Abteilung WHERE id_abteilung=$uid";
$result = dbquery($strSQL);
$row = mysql_fetch_row($result);
mysql_free_result($result);
$strPeriph = "Peripherals in use by <i>$row[0]</i>";
}
} Else {
$strCondition = "p.sparePart=1";
$strPeriph = "Spare peripherals";
$noLineBreak = TRUE;
}
$strSQL = "SELECT * FROM peripherals as p, peripheral_types as pt WHERE $strCondition ";
$strSQL .= "AND pt.peripheral_pk=p.peripheral_fk";
$result = dbquery($strSQL);
If ($noLineBreak) {
$title = $strPeriph;
} Else {
$title = "<br>".$strPeriph;
}
echo "<font size='+1'>$title</font> ";
If ($assetID != "spare") {
echo "(<A HREF='admin_peripherals.php?fk_asset=$assetID&uid=$uid'>Add New?</A>)\n";
}
?>
<p><table border='0' cellspacing='0' cellpadding='4' width='570'>
<?
if ($read_only < 1) {
// if read only don't display the action field
?>
<TR bgcolor='#C0C0C0'><TD width='180'>Description</TD><TD width='100'>Model</TD><TD width='110'>Manufacturer</TD>
<TD width='150'>Serial Number</TD><TD width='30'>External</TD> <?
} else {
?>
<TR bgcolor='#C0C0C0'><TD width='182'>Description</TD><TD width='92'>Model</TD><TD width='96'>Manufacturer</TD>
<TD width='100'>Serial Number</TD><TD width='20'>Ext?</TD><TD width='80'>Action</TD> <?
}
$iCount = 0;
While ($row = mysql_fetch_array($result)) {
$iCount++;
If (($iCount%2) == 1) {
$strColor = "#FFFFCC";
} Else {
$strColor = "#F5DEB3";
}
$pk_peripheral = $row["pk_peripheral"];
$serial_num = $row["serial_num"];
$peripheral_fk = $row["peripheral_fk"];
$external = $row["external"];
$manufacturer = $row['manufacturer'];
$model = $row['model'];
$description = $row['description'];
// Display all the peripherals belonging to this server
?>
<TR bgcolor='<?echo $strColor;?>'><TD><font size='-1'><? echo $description; ?></font></TD>
<TD><font size='-1'><? echo $model; ?></font></TD>
<TD><font size='-1'><? echo $manufacturer; ?></font></TD>
<TD><font size='-1'><? echo $serial_num; ?></font></TD>
<TD><font size='-1'><center><? echo $external; ?></center></font></TD>
<? if ($read_only == 1) {
// if we're allowing move and edit
?>
<TD><font size='-1'><A HREF="admin_peripherals.php?pk_peripheral=<? echo $pk_peripheral; ?>&uid=<? echo $uid; ?>">Edit</A>
<A HREF="move_peripheral.php?pk_peripheral=<? echo $pk_peripheral; ?>">Move</A></font></TD>
<?
} elseif ($read_only == 2) {
// if we're allowing moves
?> <TD><font size='-1'><A HREF="move_peripheral.php?pk_peripheral=<? echo $pk_peripheral; ?>">Move</A>
<?
if ($assetID == "spare") {
// if we're in the spare parts inventory we can allow deletes
?>
<A HREF="delete.php?peripheral=1&id=<? echo $pk_peripheral; ?>&delete=1" onClick="return warn_on_submit('Are you sure you want to delete this spare part?');">Delete</A></font>
<? }
?> </TD> <?
}
}
?>
</table><?
mysql_free_result($result);
If ($assetID != "spare") {
$strCondition = "s.hardware_id=$assetID";
If (!$uid) {
$strSoft = "Software associated with this spare part:";
} Else {
$strSQL = "SELECT name, id_abteilung FROM Abteilung WHERE id_abteilung=$uid";
$result = dbquery($strSQL);
$row = mysql_fetch_row($result);
mysql_free_result($result);
$strSoft = "Software in use by <i>$row[0]</i>";
}
} Else {
$strCondition = "s.sparePart=1";
$strSoft = "Spare software";
}
$strSQL = "SELECT s.id, s.serial, st.Name, st.Maker, st.Version FROM software as s, software_types as st WHERE $strCondition AND ";
$strSQL .= "st.id=s.type_id";
$result = dbquery($strSQL);
$title = $strSoft;
echo "<br><font size='+1'>$title</font> ";
If ($assetID != "spare") {
echo "(<A HREF='admin_software.php?hardware_id=$assetID&uid=$uid'>Add New?</A>)\n";
}
?>
<p><table border='0' cellpadding='4' cellspacing='0' width='570'>
<?
if ($read_only < 1) {
?> <TR bgcolor='#C0C0C0'><TD width='120'>Name</TD><TD width='150'>Manufacturer</TD><TD width='100'>Version</TD><TD width='150'>Serial Number</TD></TR> <?
} else {
?> <TR bgcolor='#C0C0C0'><TD width='150'>Name</TD><TD width='130'>Manufacturer</TD><TD width='80'>Version</TD><TD width='130'>Serial Number</TD><TD width='80'>Action</TD></TR> <?
}
$iCount = 0;
while ($row = mysql_fetch_array($result)) {
$iCount++;
If (($iCount%2) == 1) {
$strColor = "#FFFFCC";
} Else {
$strColor = "#F5DEB3";
}
$int_S_id = $row["id"];
$strSerial = $row["serial"];
$strName = $row['Name'];
$strMaker = $row['Maker'];
$strVersion = $row['Version'];
?>
<TR bgcolor='<?echo $strColor;?>'><TD><font size='-1'><? echo $strName; ?></font></TD>
<TD><font size='-1'><? echo $strMaker; ?></font></TD>
<TD><font size='-1'><? echo $strVersion; ?></font></TD>
<TD><font size='-1'><? echo $strSerial; ?></font></TD>
<? if ($read_only == 1) {
// if we're allowing move and edit
?>
<TD><font size='-1'><A HREF="admin_software.php?software_id=<? echo $int_S_id; ?>&uid=<? echo $uid; ?>">Edit</A>
<A HREF="move_software.php?software_id=<? echo $int_S_id; ?>">Move</A></font></TD>
<?
} elseif ($read_only == 2) {
// if we're allowing moves
?> <TD><font size='-1'><A HREF="move_software.php?software_id=<? echo $int_S_id; ?>">Move</A>
<? if ($assetID == "spare") {
// if we're in the spare parts inventory we can allow deletes
?>
<A HREF="delete.php?software=1&id=<? echo $int_S_id; ?>&delete=1" onClick="return warn_on_submit('Are you sure you want to delete this spare software?');">Delete</A></font>
<? }
?></TD><?
}
}
?></TABLE><?
if ($assetID == "spare") {
?>
<p><font size='+1'>Spare hardware</font><p>
<table border='0' cellpadding='4' cellspacing='0' width='570'>
<TR bgcolor='#C0C0C0'><TD width='180'>Type</TD><TD width='180'>Serial Number</TD><TD width='130'>OS</TD>
<TD width='80'>Action</TD>
<?
$strSQL = "SELECT h.pk_asset, ht.type_desc, h.serial_num, h.o_s FROM hardware as h, hw_types as ht WHERE h.type=ht.type_pk AND h.sparePart=1";
$result = dbquery($strSQL);
$iCount = 0;
while ($row = mysql_fetch_array($result)) {
$iCount++;
If (($iCount%2) == 1) {
$strColor = "#FFFFCC";
} Else {
$strColor = "#F5DEB3";
}
$strDesc = $row["type_desc"];
$strSerial = $row["serial_num"];
$strOS = $row["o_s"];
$strID = $row["pk_asset"];
?>
<TR bgcolor='<?echo $strColor;?>'><TD width='180'><font size='-1'><A HREF="showfull.php?id=<? echo $strID; ?>&spare=1"><? echo $strDesc; ?></a></font></TD>
<TD width='180'><font size='-1'><? echo $strSerial; ?></font></TD>
<TD width='130'><font size='-1'><? echo $strOS; ?></font></TD>
<TD width='80'><font size='-1'><a href='move_hardware.php?hardware_id=<?echo $strID;?>'>Move</a>
<a href='delete.php?hardware=1&id=<?echo $strID;?>&delete=1' onClick="return warn_on_submit('This will delete this PC, and all software/peripherals associated with it.')">Delete</a></font></TD>
<?
}
?></table><?
}
}
?>
Kommentar