本文整理汇总了PHP中AddTableWrappers函数的典型用法代码示例。如果您正苦于以下问题:PHP AddTableWrappers函数的具体用法?PHP AddTableWrappers怎么用?PHP AddTableWrappers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddTableWrappers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetAddedDataLookupQuery
/**
* @param Array keys
* @param Boolean forLookup
* @param String _table
* @param String _field
* @param String pageType
* @return Array
*/
public function GetAddedDataLookupQuery($keys, $forLookup, $_table, $_field, $pageType)
{
$lookupMainSettings = getLookupMainTableSettings($this->tName, $_table, $_field, $pageType);
if(!$lookupMainSettings)
return array();
global $conn;
$LookupSQL = "";
$mainField = $_field;
$mainTable = $lookupMainSettings->getTableName();
$linkFieldName = $lookupMainSettings->getLinkField($mainField);
$dispfield = $lookupMainSettings->getDisplayField($mainField);
$nLookupType = $lookupMainSettings->getLookupType($mainField);
if($nLookupType == LT_QUERY)
{
if($lookupMainSettings->getCustomDisplay($mainField))
$this->pSet->getSQLQuery()->AddCustomExpression($dispfield, $this->pSet, $mainTable, $mainField);
$lookupQueryObj = $this->pSet->getSQLQuery()->CloneObject();
}
else
{
$LookupSQL = "select ";
$LookupSQL .= GetFullFieldName($linkFieldName, $this->tName, true);
if($linkFieldName != $dispfield)
$LookupSQL .= "," . $this->pSet->getLWDisplayField($mainField, true);
$LookupSQL.=" from ".AddTableWrappers($this->strOriginalTableName);
}
$data = 0;
$lookupIndexes = array("linkFieldIndex" => 0, "displayFieldIndex" => 0);
if(count($keys))
{
$where = KeyWhere($keys);
if($nLookupType == LT_QUERY)
$LookupSQL = $lookupQueryObj->toSql(whereAdd($lookupQueryObj->m_where->toSql($lookupQueryObj), $where));
else
$LookupSQL.=" where ".$where;
$lookupIndexes = GetLookupFieldsIndexes($lookupMainSettings, $mainField);
LogInfo($LookupSQL);
if($forLookup)
{
$rs=db_query($LookupSQL,$conn);
$data = $this->cipherer->DecryptFetchedArray($rs);
}
else if($LookupSQL)
{
$rs = db_query($LookupSQL,$conn);
$data = db_fetch_numarray($rs);
$data[$lookupIndexes["linkFieldIndex"]] = $this->cipherer->DecryptField($linkFieldName, $data[$lookupIndexes["linkFieldIndex"]]);
if($nLookupType == LT_QUERY)
$data[$lookupIndexes["displayFieldIndex"]] = $this->cipherer->DecryptField($dispfield, $data[$lookupIndexes["displayFieldIndex"]]);
}
}
return array($data, array("linkField" => $linkFieldName, "displayField" => $dispfield
, "linkFieldIndex" => $lookupIndexes["linkFieldIndex"], "displayFieldIndex" => $lookupIndexes["displayFieldIndex"]));
}
示例2: ViewLookupWizardField
public function ViewLookupWizardField($field, $container, $pageObject)
{
parent::ViewControl($field, $container, $pageObject);
$this->nLookupType = null;
$this->lookupTable = "";
$this->displayFieldName = "";
$this->linkFieldName = "";
$this->linkAndDisplaySame = false;
$this->lookupPSet = null;
$this->cipherer = null;
$this->lookupQueryObj = null;
$this->displayFieldIndex = 0;
$this->LookupSQL = "";
if ($this->container->pSet->getEditFormat($field) != EDIT_FORMAT_LOOKUP_WIZARD) {
$this->pSet = new ProjectSettings($this->container->pSet->_table, $this->container->pSet->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD));
} else {
$this->pSet = $this->container->pSet;
}
$this->nLookupType = $this->pSet->getLookupType($this->field);
$this->lookupTable = $this->pSet->getLookupTable($this->field);
$this->displayFieldName = $this->pSet->getDisplayField($this->field);
$this->linkFieldName = $this->pSet->getLinkField($this->field);
$this->linkAndDisplaySame = $this->displayFieldName == $this->linkFieldName;
if ($this->nLookupType == LT_QUERY) {
$this->lookupPSet = new ProjectSettings($this->lookupTable, $this->container->pageType);
$this->cipherer = new RunnerCipherer($this->lookupTable);
if ($this->pSet->getCustomDisplay($this->field)) {
$this->lookupPSet->getSQLQuery()->AddCustomExpression($this->displayFieldName, $this->lookupPSet, $this->pSet->_table, $this->field);
}
$this->lookupQueryObj = $this->lookupPSet->getSQLQuery()->CloneObject();
$this->lookupQueryObj->ReplaceFieldsWithDummies($this->lookupPSet->getBinaryFieldsIndices());
$lookupIndexes = GetLookupFieldsIndexes($this->pSet, $this->field);
$this->displayFieldIndex = $lookupIndexes["displayFieldIndex"];
} else {
$this->cipherer = new RunnerCipherer($this->pSet->_table);
$this->LookupSQL = "SELECT ";
$this->LookupSQL .= $this->pSet->getLWDisplayField($this->field);
$this->LookupSQL .= " FROM " . AddTableWrappers($this->pSet->getLookupTable($this->field)) . " WHERE ";
}
$this->localControlsContainer = new ViewControlsContainer($this->pSet, $this->container->pageType, $pageObject);
$this->localControlsContainer->isLocal = true;
}
示例3: InsertRecord
function InsertRecord($arr, $recInd)
{
global $goodlines, $conn, $error_message, $keys_present, $keys, $strOriginalTableName, $strTableName, $eventObj, $locale_info, $auditObj;
$ret = 1;
$rawvalues = array();
foreach ($arr as $key => $val) {
$rawvalues[$key] = $val;
$type = GetFieldType($key);
if (!NeedQuotes($type)) {
$value = (string) $val;
$value = str_replace(",", ".", $value);
if (strlen($value) > 0) {
$value = str_replace($locale_info["LOCALE_SCURRENCY"], "", $value);
$arr[$key] = 0 + $value;
} else {
$arr[$key] = NULL;
}
}
}
$retval = true;
if ($eventObj->exists('BeforeInsert')) {
$retval = $eventObj->BeforeInsert($rawvalues, $arr);
}
if ($retval) {
$fields = array_keys($arr);
foreach ($fields as $key => $val) {
$fields_list[$key] = AddFieldWrappers(GetFullFieldName($val));
}
$values_list = "";
foreach ($arr as $key => $val) {
if (!is_null($arr[$key])) {
$values_list .= add_db_quotes($key, $val) . ", ";
} else {
$values_list .= "NULL, ";
}
}
if (strlen($values_list) > 0) {
$values_list = substr($values_list, 0, strlen($values_list) - 2);
}
$sql = "insert into " . AddTableWrappers($strOriginalTableName) . " (" . implode(",", $fields_list) . ") values (" . $values_list . ")";
if (db_exec_import($sql, $conn)) {
$goodlines++;
if ($auditObj) {
$aKeys = GetKeysArray($arr, true);
$auditObj->LogAdd($strTableName, $arr, $aKeys);
}
} else {
$temp_error_message = "<b>Error:</b> in the line: " . implode(",", $arr) . ' <a linkType="debugOpener" recId="' . $recInd . '" href="" onclick="importMore(' . $recInd . ');">More info</a><br>';
$temp_error_message .= '<div id="importDebugInfoTable' . $recInd . '" cellpadding="3" cellspacing="1" align="center" style="display: none;"><p class="error">SQL query: ' . $sql . '; </p><p class="error">DB error: ' . db_error($conn) . ';</p></div>';
$temp_error_message .= "<br><br>";
// we'll try to update the record
if ($keys_present) {
$sql = "update " . AddTableWrappers($strOriginalTableName) . " set ";
$sqlset = "";
$where = " where ";
foreach ($fields as $k => $val) {
if (!in_array(AddFieldWrappers($fields[$k]), $keys)) {
if (!is_null($arr[$val])) {
$sqlset .= $fields_list[$k] . "=" . add_db_quotes($val, $arr[$val]) . ", ";
} else {
$sqlset .= $fields_list[$k] . "=NULL, ";
}
} else {
$where .= $fields_list[$k] . "=" . add_db_quotes($val, $arr[$val]) . " and ";
}
}
if (strlen($sqlset) > 0) {
$sql .= substr($sqlset, 0, strlen($sqlset) - 2);
}
$where = substr($where, 0, strlen($where) - 5);
$sql .= " " . $where;
$rstmp = db_query("select * from " . AddTableWrappers($strOriginalTableName) . " " . $where, $conn);
$data = db_fetch_array($rstmp);
if ($data) {
if ($auditObj) {
foreach ($data as $key => $val) {
$auditOldValues[$key] = $val;
}
}
if (db_exec_import($sql, $conn)) {
// update successfull
$goodlines++;
if ($auditObj) {
$aKeys = GetKeysArray($arr);
$auditObj->LogEdit($strTableName, $arr, $auditOldValues, $aKeys);
}
} else {
echo 'not updated';
// update not successfull
$error_message .= $temp_error_message;
$ret = 0;
}
} else {
$error_message .= $temp_error_message;
$ret = 0;
}
} else {
$error_message .= $temp_error_message;
}
}
//.........这里部分代码省略.........
示例4: foreach
$keyToModify[$screen][$key] = false;
}
}
}
foreach ($keyToModify as $screen => $data){
foreach ($data as $key => $val){
$rpt_array[$xml_field][$screen][$key] = $val;
}
}
}
}
$rpt_array['miscellaneous']['print_friendly'] = ($rpt_array['miscellaneous']['print_friendly'] == "true") ? true : false;
// Load and assign styles
$sql_query = "SELECT " . AddFieldWrappers("report_style_id") . "," . AddFieldWrappers("type") . "," . AddFieldWrappers("field") . "," . AddFieldWrappers("group") . "," . AddFieldWrappers("style_str") . "," . AddFieldWrappers("uniq") . ", " . AddFieldWrappers("repname") . ", " . AddFieldWrappers("styletype") . " FROM " . AddTableWrappers("webreport_style") . " WHERE " . AddFieldWrappers("repname") . "=" . db_prepare_string(postvalue('rname')) . " ORDER BY " . AddFieldWrappers("report_style_id") . " ASC";
$rsReport = db_query($sql_query, $conn);
$styleStr = '';
while ($data = db_fetch_numarray($rsReport)){
if ($data[1] == 'table')
$styleStr .= "#legend td{" . $data[4] . "}\n";
else if (($data[2] == 0) && ($data[3] != 0))
$styleStr .= "#legend td.class" . $data[3] . "g" . "{" . $data[4] . "}\n";
else if (($data[2] != 0) && ($data[3] == 0))
$styleStr .= "#legend td.class" . $data[2] . "f" . "{" . $data[4] . "}\n";
else if ($data[5] == 0 && $data[2] != 0 && $data[3] != 0)
$styleStr .= "#legend td.class" . $data[3] . "g" . $data[2] . "f0u{" . $data[4] . "}\n";
else
$styleStr .= "#legend td.class" . $data[3] . "g" . $data[2] . "f" . $data[5] . "u" . "{" . $data[4] . "}\n";
示例5: addMasterDetailSubQuery
/**
* Adds sub query for counting details recs number
*
*/
function addMasterDetailSubQuery()
{
// add count of child records to SQL
if ($this->subQueriesSupp && $this->subQueriesSupAccess && !$this->theSameFieldsType) {
for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) {
if ($this->allDetailsTablesArr[$i]['dispChildCount'] || $this->allDetailsTablesArr[$i]['hideChild']) {
$origTName = $this->allDetailsTablesArr[$i]['dOriginalTable'];
$dataSourceTName = $this->allDetailsTablesArr[$i]['dDataSourceTable'];
$shortTName = $this->allDetailsTablesArr[$i]['dShortTable'];
$detailsSettings = $this->pSet->getTable($dataSourceTName);
$detailsQuery = $detailsSettings->getSQLQuery();
$detailsSqlWhere = $detailsQuery->WhereToSql();
$masterWhere = "";
foreach ($this->masterKeysByD[$i] as $idx => $val) {
if ($masterWhere) {
$masterWhere .= " and ";
}
$masterWhere .= $this->cipherer->GetFieldName(AddTableWrappers("subQuery_cnt") . "." . AddFieldWrappers($this->detailKeysByD[$i][$idx]), $this->masterKeysByD[$i][$idx]) . "=" . $this->cipherer->GetFieldName(AddTableWrappers($this->origTName) . "." . AddFieldWrappers($this->masterKeysByD[$i][$idx]), $this->masterKeysByD[$i][$idx]);
}
// add a key field to the select list
$subQ = "";
foreach ($this->detailKeysByD[$i] as $k) {
if (strlen($subQ)) {
$subQ .= ",";
}
$subQ .= GetFullFieldNameForInsert($this->pSet, $k);
}
$subQ = "SELECT " . $subQ . " " . $detailsQuery->FromToSql();
// add security where clause for sub query
$securityClause = SecuritySQL("Search", $dataSourceTName);
if (strlen($securityClause)) {
$subQ .= " WHERE " . whereAdd($detailsSqlWhere, $securityClause);
} elseif (strlen($detailsSqlWhere)) {
$subQ .= " WHERE " . whereAdd("", $detailsSqlWhere);
}
// add detail table query tail
$subQ .= " " . $detailsQuery->TailToSql();
$countsql = "SELECT count(*) FROM (" . $subQ . ") " . AddTableWrappers("subQuery_cnt") . " WHERE " . $masterWhere;
$this->gsqlHead .= ",(" . $countsql . ") as " . AddFieldWrappers($dataSourceTName . "_cnt") . " ";
}
}
}
}
示例6: DoInsertRecordSQL
function DoInsertRecordSQL($table, &$avalues, &$blobfields, $pageid, &$pageObject, &$cipherer)
{
global $error_happened, $conn, $inlineadd, $usermessage, $message, $failed_inline_add, $keys, $strTableName;
// make SQL string
$strSQL = "insert into " . AddTableWrappers($table) . " ";
$strFields = "(";
$strValues = "(";
$blobs = PrepareBlobs($avalues, $blobfields);
foreach ($avalues as $akey => $value) {
$strFields .= $pageObject->pSet->getTableField($akey) . ", ";
if (in_array($akey, $blobfields)) {
$strValues .= $value . ", ";
} else {
if (is_null($cipherer)) {
$strValues .= add_db_quotes($akey, $value) . ", ";
} else {
$strValues .= $cipherer->AddDBQuotes($akey, $value) . ", ";
}
}
}
if (substr($strFields, -2) == ", ") {
$strFields = substr($strFields, 0, strlen($strFields) - 2);
}
if (substr($strValues, -2) == ", ") {
$strValues = substr($strValues, 0, strlen($strValues) - 2);
}
$strSQL .= $strFields . ") values " . $strValues . ")";
if (!ExecuteUpdate($pageObject, $strSQL, $blobs, true)) {
return false;
}
if ($error_happened) {
return false;
}
$pageObject->ProcessFiles();
if ($inlineadd == ADD_INLINE) {
$status = "ADDED";
$message = "" . "Record was added" . "";
$IsSaved = true;
} else {
$message = "<<< " . "Record was added" . " >>>";
}
if ($usermessage != "") {
$message = $usermessage;
}
$auditObj = GetAuditObject($table);
if ($inlineadd == ADD_SIMPLE || $inlineadd == ADD_INLINE || $inlineadd == ADD_ONTHEFLY || $inlineadd == ADD_POPUP || $inlineadd == ADD_MASTER || tableEventExists("AfterAdd", $strTableName) || $auditObj) {
$failed_inline_add = false;
$keyfields = $pageObject->pSet->getTableKeys();
foreach ($keyfields as $k) {
if (array_key_exists($k, $avalues)) {
$keys[$k] = $avalues[$k];
} elseif ($pageObject->pSet->isAutoincField($k)) {
$lastrs = @db_query("SELECT lastval()", $conn);
if ($lastdata = db_fetch_numarray($lastrs)) {
$keys[$k] = $lastdata[0];
}
} else {
$failed_inline_add = true;
}
}
}
return true;
}
示例7: toSql
function toSql($query)
{
return AddTableWrappers($this->m_strName);//SmartAddTableWrappers(m_strName);
}
示例8: FetchByID
function FetchByID()
{
global $conn, $dal_info;
$tableinfo =& $dal_info[$this->m_TableName];
$dal_where = "";
foreach ($tableinfo as $fieldname => $fld) {
$command = 'if(isset($this->' . $fld['varname'] . ')) { ';
$command .= '$this->Value[\'' . escapesq($fieldname) . '\'] = $this->' . $fld['varname'] . ';';
$command .= ' }';
eval($command);
foreach ($this->Param as $field => $value) {
if (strtoupper($field) != strtoupper($fieldname)) {
continue;
}
$dal_where .= AddFieldWrappers($fieldname) . "=" . $this->PrepareValue($value, $fld["type"]) . " and ";
break;
}
}
// cleanup
$this->Reset();
// construct and run SQL
if ($dal_where) {
$dal_where = " where " . substr($dal_where, 0, -5);
}
$dalSQL = "select * from " . AddTableWrappers($this->m_TableName) . $dal_where;
$rs = db_query($dalSQL, $conn);
return $rs;
}
示例9: hasDuplicateValue
/**
* Check if the field's value duplicates with any of database field's values
*
* @param {String} $fieldName
* @param {String | Number} $value
* @retrun {Boolean}
*/
function hasDuplicateValue($fieldName, $value)
{
global $conn;
if($this->cipherer->isFieldEncrypted($fieldName))
{
$value = $this->cipherer->MakeDBValue($fieldName, $value, "", "", true);
}
else
{
$value = add_db_quotes($fieldName, $value);
}
$where = GetFullFieldName($fieldName, $this->tName, false).'='.$value;
$sql = "SELECT count(*) from ".AddTableWrappers($this->pSet->getOriginalTableName())." where ".$where;
$rs = db_query($sql, $conn);
$data = db_fetch_numarray($rs);
if(!$data[0])
{
return false;
}
return true;
}
示例10: array
$arr_UserGroups = array();
foreach(GetUserGroups() as $idx=>$value)
if($value[0]!="Guest")
$arr_UserGroups[]=$value;
}
$group_list="";
$groupSelected="";
$wr_user=postvalue("username");
if($wr_is_standalone)
{
if(postvalue("editid1"))
{
$rs=db_query("select ".AddFieldWrappers("username")." from ".AddTableWrappers("webreport_users")." where ".AddFieldWrappers("id")."=".postvalue("editid1"),$conn);
$data=db_fetch_numarray($rs);
if($data)
$wr_user=$data[0];
}
}
if(count($arr_UserGroups))
{
usort($arr_UserGroups,"sortUserGroup");
$groups=$arr_UserGroups;
$i=0;
if(!$wr_is_standalone)
$xt->assign("group_header","User Groups");
else
示例11: db_prepare_string
// username and password are stored in the database
$strUsername = (string) $pUsername;
$strPassword = (string) $pPassword;
$sUsername = $strUsername;
$sPassword = $strPassword;
if (NeedQuotes($cUserNameFieldType)) {
$strUsername = db_prepare_string($strUsername);
} else {
$strUsername = 0 + $strUsername;
}
if (NeedQuotes($cPasswordFieldType)) {
$strPassword = db_prepare_string($strPassword);
} else {
$strPassword = 0 + $strPassword;
}
$strSQL = "select * from " . AddTableWrappers("dbo.System Users") . " where " . AddFieldWrappers($cUserNameField) . "=" . $strUsername . " and " . AddFieldWrappers($cPasswordField) . "=" . $strPassword;
$retval = true;
$logged = false;
$data = array();
if ($globalEvents->exists("BeforeLogin")) {
$retval = $globalEvents->BeforeLogin($pUsername, $pPassword, $message);
}
if ($retval) {
$rs = db_query($strSQL, $conn);
$data = db_fetch_array($rs);
if ($data) {
if (@$data[$cUserNameField] == $sUsername && @$data[$cPasswordField] == $sPassword) {
$logged = true;
}
}
}
示例12: make_from_clause
function make_from_clause($type)
{
$accessMode=(GetDatabaseType()==3);
$root=&$_SESSION[$type];
$ret=AddTableWrappers($root['tables'][0]);
$fullouter="";
$firstJoin=true;
if(is_array($root["table_relations"]["relat"]))
{
foreach($root["table_relations"]["relat"] as $r)
{
if(trim($r["rel_type"])=="FULL OUTER JOIN")
{
$fullouter.="\n,".AddTableWrappers($r["right_table"]);
continue;
}
if($accessMode && !$firstJoin)
{
$ret="(".$ret.")";
}
$firstJoin=false;
$ret.="\n".$r["rel_type"]." ".AddTableWrappers($r["right_table"])." ON ";
$joinon="";
foreach($r["left_fields"] as $i=>$f)
{
if(strlen($joinon))
$joinon.=" AND ";
$joinon.=AddTableWrappers($r["left_table"]).".".AddFieldWrappers($r["left_fields"][$i]);
$joinon.="=";
$joinon.=AddTableWrappers($r["right_table"]).".".AddFieldWrappers($r["right_fields"][$i]);
}
$ret.=$joinon;
}
}
return "FROM ".$ret.$fullouter;
}
示例13: getCustomSQLbyName
function getCustomSQLbyName($sqlname)
{
global $conn;
$rs=db_query("select * from ".AddTableWrappers("webreport_sql")." where ".AddFieldWrappers("sqlname")."='".$sqlname."'",$conn);
if($data = db_fetch_array($rs))
return array($data["id"],$data["sqlname"],$data["sqlcontent"]);
return "";
}
示例14: db_exec
$rsReport = db_exec($strSQL,$conn);
}
if ($style_record['type'] == "group"){
if ($style_record['params']['groupName'] != 0){
$strSQL = "DELETE FROM ".AddTableWrappers("webreport_style")." WHERE (".AddFieldWrappers("group")." = ".(0+$style_record["params"]["groupName"])." AND ".AddFieldWrappers("repname")."=".db_prepare_string($repname)." AND ".AddFieldWrappers("styletype")."='".$style_record["params"]["styleType"]."' AND (".AddFieldWrappers("type")."='cell' OR ".AddFieldWrappers("type")."='group'))";
$rsReport = db_exec($strSQL,$conn);
}
}
if ($style_record['type'] == "field"){
$strSQL = "DELETE FROM ".AddTableWrappers("webreport_style")." WHERE (".AddFieldWrappers("field")." = ".($style_record["params"]["fieldName"]+0)." AND ".AddFieldWrappers("repname")."=".db_prepare_string($repname)." AND ".AddFieldWrappers("styletype")."='".$style_record["params"]["styleType"]."' and ".AddFieldWrappers("type")."='field')";
$rsReport = db_exec($strSQL,$conn);
}
if ($style_record['type'] == "cell"){
$style_record['params']['uniq'] = (int)$style_record['params']['uniq'];
$strSQL = "DELETE FROM ".AddTableWrappers("webreport_style")." WHERE (".AddFieldWrappers("type")." = '".$style_record["type"]."' AND ".AddFieldWrappers("field")." = ".($style_record["params"]["fieldName"]+0)." AND ".AddFieldWrappers("group")." = ".(0+$style_record["params"]["groupName"])." AND ".AddFieldWrappers("uniq")."=".(int)$style_record["params"]["uniq"]." AND ".AddFieldWrappers("repname")."=".db_prepare_string($repname)." AND ".AddFieldWrappers("styletype")."='".$style_record["params"]["styleType"]."')";
$rsReport = db_exec($strSQL,$conn);
}
$strSQL = "INSERT INTO ".AddTableWrappers("webreport_style")." (".AddFieldWrappers("type").",".AddFieldWrappers("field").",".AddFieldWrappers("group").",".AddFieldWrappers("style_str").",".AddFieldWrappers("uniq").",".AddFieldWrappers("repname").",".AddFieldWrappers("styletype").") VALUES ('".$style_record['type']."',".db_prepare_string($style_record["params"]["fieldName"]).",".$style_record['params']['groupName'].",".db_prepare_string($style_record['params']['styleStr']).",".$style_record['params']['uniq'].",".db_prepare_string($repname).",'".$style_record['params']['styleType']."')";
$rsReport = db_exec($strSQL,$conn);
}
echo 'OK';
?>
示例15: db_fetch_numarray
$datacount = db_fetch_numarray($rs1);
if (!$datacount[0]) {
foreach ($fieldsArr as $f) {
$fEditFormat = GetFieldData($strTableName, $f, 'EditFormat', '');
if ($fEditFormat != EDIT_FORMAT_LOOKUP_WIZARD || GoodFieldName($f) != $field) {
continue;
}
$LookupType = GetFieldData($strTableName, $f, 'LookupType', '');
if ($LookupType == LT_LOOKUPTABLE) {
$LookupSQL = "SELECT ";
if (GetFieldData($strTableName, $f, 'LookupUnique', false)) {
$LookupSQL .= "DISTINCT ";
}
$LookupSQL .= GetLWLinkField($f, $strTableName, true);
$LookupSQL .= "," . GetLWDisplayField($f, $strTableName, true);
$LookupSQL .= " FROM " . AddTableWrappers(GetFieldData($strTableName, $f, 'LookupTable', '')) . " ";
$LookupSQL .= " WHERE " . GetLWLinkField($f, $strTableName, true) . "=" . $lookupValue . " AND ";
$LookupSQL .= GetLWDisplayField($f, $strTableName, true) . " LIKE " . db_prepare_string($value . "%");
if (GetFieldData($strTableName, $f, 'UseCategory', false)) {
$cvalue = make_db_value(GetFieldData($strTableName, $f, 'CategoryControl', ''), postvalue("category"));
$LookupSQL .= " AND " . AddFieldWrappers(GetFieldData($strTableName, $f, 'CategoryFilter', '')) . "=" . $cvalue;
}
}
}
$rs2 = db_query($LookupSQL, $conn);
if ($data = db_fetch_numarray($rs2)) {
$response[] = $data[0];
$response[] = $data[1];
}
}
}