/** * @return put return description here.. * @param param : parameter passed to function * @desc buildDropDown($idField,$labelField,$tableName,$conditionField="",$conditionValue="",$labelField2 = "") : put function description here ... */ function buildDropDown($idField, $labelField, $tableName, $conditionField = "", $conditionValue = "", $labelField2 = "") { global $db; if ($labelField2 != "") { $lab2 = ", {$labelField2}"; } else { $lab2 = ""; } if ($conditionField != "") { $whereClause = " where {$conditionField}='{$conditionValue}' "; } $querydrop = "select {$idField},{$labelField} {$lab2} from {$tableName} {$whereClause} "; $thisDatabaseQuery = new databaseQuery(); $thisDatabaseQuery->setSqlQuery($querydrop); $thisDatabaseQuery->executeQuery(); $result = $thisDatabaseQuery->getResultSet(); if ($result == false) { $thisError = new errorHandler(); $thisError->setUserErrorMessage("An Error Occured while trying to build drop down box from database"); $thisError->setProgramErrorMessage("An Error Occured while trying to build drop down box from database in function buildDropDown()" . $querydrop); $thisError->handleError(); } else { if ($result->RowCount() == 0) { return ""; } else { if ($result->RowCount() > 0) { while (!$result->EOF) { $id = $result->fields[$idField]; $label = $result->fields[$labelField]; if ($labelField2 != "") { $label2 = $result->fields[$labelField2]; } echo "<option value=\"{$id}\">{$label}"; if ($labelField2 != "") { echo " {$label2} "; } echo "</option>"; $result->MoveNext(); } } } } }
function countReturnRows() { $this->buildSearchSQL(); $query = new databaseQuery(); $query->setSqlQuery($this->getSql()); //$result = $query->getDbConn()->Execute($newQuery); $result = $query->countResultSet(); if ($result == false) { $thisError = new errorHandler(); $thisError->setUserErrorMessage("A Database Error Occured while counting result Rows "); $thisError->setProgramErrorMessage($this->dbConn->ErrorMsg()); $thisError->setErrorPage($_SERVER['PHP_SELF']); $thisError->handleError(); return 0; } else { return $query->getTotalRows(); } }