The site has moved. Please update your bookmarks.

If you are not redirected, click here to access the PDSP IMS site.




Not Specified / NULL"); if (mysqli_num_rows($queryResult) != 0) { while ($row = mysqli_fetch_row($queryResult)) { // maybe check to see if the value is null, if so, don't include it? $ddOption = $row[1]; if ($limit != NULL) $ddOption = substr($ddOption, 0, $limit); print(""); } } else { print(""); } mysqli_free_result($queryResult); } function populateDropDownOrderBy($tableName, $ddEntryField, $ddValueField, $orderByField) { $query = "select ".$ddValueField.", ".$ddEntryField." from ".$tableName; $query.= " order by ".$orderByField; $queryError = "Unable to query table: ".$tableName." with query: "; global $link; $queryResult = mysqli_query($link,$query) or die($queryError.$query); if (mysqli_num_rows($queryResult) != 0) { while ($row = mysqli_fetch_row($queryResult)) { // maybe check to see if the value is null, if so, don't include it? print(""); } } else { print(""); } mysqli_free_result($queryResult); } // all these functions are very similar, and if php supported overloading methods // we'd be in business. Unfortunately, you can't do that, so we have all these // crazy names. function populateDropDownSelOrderBy($tableName, $ddEntryField, $ddValueField, $orderByField, $sel) { $query = getBaseQuery($ddValueField, $ddEntryField, $tableName)." order by ".$orderByField; $queryError = "Unable to query table: ".$tableName." with query: "; doQuery($query, $queryError, $sel, NULL); } function populateDropDownSelLimitOrderBy($tableName, $ddEntryField, $ddValueField, $orderByField, $sel, $maxLength) { $query = getBaseQuery($ddValueField, $ddEntryField, $tableName)." order by ".$orderByField; $queryError = "Unable to query table: ".$tableName." with query: "; //print("Limiting the length!
"); doQuery($query, $queryError, $sel, $maxLength); } // so this one uses a lookup table to figure out what to populate the drop down with // it also orders by, and you can select a value as well, so this is like everything // else we've been using, in addition to using role specific population...joy function populateRoleDropDownSelOrderBy($ddTableName, $lookupTableName, $roleIDColName, $roleID, $ddIDColName, $ddNameColName, $orderByField, $sel) { $query = "select distinct ".$ddTableName.".".$ddIDColName.", "; $query.= $ddNameColName." from ".$ddTableName; $query.= ", ".$lookupTableName." where "; $query.= $ddTableName.".".$ddIDColName." = ".$lookupTableName.".".$ddIDColName; // so if the sel field is NULL, ignore it if ($sel == NULL) { $query.= " and ".$roleIDColName." = ".$roleID." order by ".$orderByField; } else { $query.= " and (".$roleIDColName." = ".$roleID." or ".$ddTableName.".".$ddIDColName; $query.= " = ".$sel.") order by ".$orderByField; } $queryError = "Unable to populate status drop down!
"; doQuery($query, $queryError, $sel, NULL); } // anyway, this stuff down here is common to them all function getBaseQuery($ddValueField, $ddEntryField, $tableName) { return "select ".$ddValueField.", ".$ddEntryField." from ".$tableName; } // you specify with the id, not with the name // so make sure that $ddValueField is the field you are looking for function doQuery($query, $queryError, $specify, $maxLength) { global $link; $queryResult = mysqli_query($link,$query) or die($queryError.$query); if (mysqli_num_rows($queryResult) != 0) { if ($maxLength != NULL) { // so here we have to trim the value down to maxLength //$ddOption = substr($ddOption, 0, $maxLength); } if ($specify != NULL) { while ($row = mysqli_fetch_row($queryResult)) { print(""); //} //print(">"); if (strlen($row[1]) > $maxLength) { $newString = substr($row[1], 0, $maxLength); print($newString."..."); } else { print($row[1]); } //print("\n"); //print($row[1]); } else print($row[1]); print(""); } } else { while ($row = mysqli_fetch_row($queryResult)) { // maybe check to see if the value is null, if so, don't include it? print(""); } } } else { print(""); } mysqli_free_result($queryResult); } ?> thisUserIP = $userIP; $this->LOG_TABLE_NAME = "pdspTEMP.projectLog"; } // this is the only method that actually accesses the // database function logAccess($recID, $desc) { $query = "insert into ".$this->LOG_TABLE_NAME. " ("; $query.= "userIPAddress, recID, accessDesc, "; $query.= "accessDateTime) values ('"; $query.= $this->thisUserIP."',".$recID.", '".$desc."', now())"; global $link; mysqli_query($link,$query) or die ("Unable to log access! Error: ".mysqli_error($link)."
Query: ".$query."
"); // otherwise, we're good to go :) } } ?> fp = fopen($fileToRead, $accessType); } // returns the next line from a string, or NULL if the end of file was reached function readLine() { if ($this->fp) { if (!feof($this->fp)) { return fgets($this->fp, 4096); } } else { print("File pointer invalid!"); } return NULL; } // returns a string representation of the file, or NULL if the file pointer was invalid // most of the time that just means it didn't open correctly, the file might not exist, etc function getFileContents() { $fileContents = ""; if ($this->fp) { while (!feof($this->fp)) { $buffer = fgets($this->fp, 4096); $fileContents.=$buffer; } } else { print("File pointer invalid!"); $fileContents = NULL; } return $fileContents; } function closeFile() { fclose($this->fp); } } ?>