Es wird folgender Fehler ausgegeben:
Fatal error: Call to undefined function: buildabteilungselect() in /usr/local/httpd/htdocs/phpMyInventory/move_abteilung.php on line 38
Außerdem gibt er mir den gesamten Code von der Funktion oben aus.
Der Code lautet so:
Die Funktion lautet so:
Fatal error: Call to undefined function: buildabteilungselect() in /usr/local/httpd/htdocs/phpMyInventory/move_abteilung.php on line 38
Außerdem gibt er mir den gesamten Code von der Funktion oben aus.
Der Code lautet so:
PHP-Code:
<?
$intSecurity = 1;
$intTimeOut = 1800;
include "includes/security.inc.php";
include "includes/db.inc.php";
include "includes/functions.inc.php";
include "includes/user_func.inc.php";
// Has the form been submitted
if ($REQUEST_METHOD == 'POST') {
if ($id_abteilung) {
if ($cboAbteilung != "spare") {
if (!$cboAbteilung) {
$strError = "Please select a department.";
} else {
$strSQL = "UPDATE hardware SET abteilung_fk=$cboAbteilung, sparePart=0 WHERE pk_asset=$hardware_id";
$result = dbquery($strSQL);
header("Location: ./index.php?notify=update");
}
} else {
$strSQL = "UPDATE hardware SET abteilung_fk=0, sparePart=1 WHERE pk_asset=$hardware_id";
$result = dbquery($strSQL);
header("Location: ./index.php?notify=update");
}
} else {
$strError = "Unexpected error: please return to the <a href='index.php'>home page</a>, and retry this operation.";
}
}
include "includes/header.inc.php";
declareError(TRUE);
?>
<FORM METHOD="post" ACTION="<? echo $PHP_SELF?>">
<INPUT TYPE="hidden" NAME="hardware_id" VALUE="<? echo $hardware_id; ?>">
Assign to this department: <? echo buildAbteilungSelect($cboAbteilung, TRUE); ?>
<p>
<font size='-1'>
<INPUT TYPE="submit" NAME="submit" VALUE="Submit Change"> <A HREF="index.php">Never Mind</A></font>
</FORM>
<?
include "includes/footer.inc.php";
?>
Die Funktion lautet so:
PHP-Code:
Function buildAbteilungSelect($intAbteilung, $showSpare) {
# $strSQL = "SELECT count(*) FROM Abteilung";
# $result = dbquery($strSQL);
# $row = mysql_fetch_row($result);
# $numAbteilung = $row[0];
# mysql_free_result($result);
# If ($numAbteilung > 70) {
# } Else {
$strSQL = "SELECT name, id_abteilung FROM Abteilung ORDER BY name";
$result = dbquery($strSQL);
$strReturnString = "<select name='cboAbteilung' size='1'>\n";
$strReturnString .= "<option value=''> </option>\n";
if ($showSpare) {
$strReturnString .= "<option value='spare'>** Make Spare Part **</option>\n";
}
while ($row = mysql_fetch_array($result)) {
$strReturnString .= "<option value='".$row['id_abteilung']."' ".writeSelected($row['id_abteilung'], $intAbteilung).">";
$strReturnString .= "</option>\n";
}
$strReturnString .= "</select>\n";
# }
Return $strReturnString;
}
Kommentar