Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

making queryes in many fields

Codes here !

Moderators: macek, egami, gesf

making queryes in many fields

Postby gdhia » Mon May 07, 2012 4:50 am


I have some code that will allow search for a value entered in a form in a field of a database. The name of this field is: "work_field".
In my database, I have actually three fields like: "work_field0", "work_field1" and "work_field2".

How can I modify this code so that research is done in four fields "work_field", "work_field0", "work_field1" and "work_field2"?

thank you
Code: Select all
if(GetLookupTable("work_field", $strTableName))
$pageObject->settingsMap["globalSettings"]['shortTNames'][GetLookupTable("work_field", $strTableName)] = GetTableURL(GetLookupTable("work_field", $strTableName));


$srchFields = $pageObject->searchClauseObj->getSearchCtrlParams("work_field");
$firstFieldParams = array();
if (count($srchFields))
$firstFieldParams = $srchFields[0];
$firstFieldParams['fName'] = "work_field";
$firstFieldParams['eType'] = '';
$firstFieldParams['value1'] = '';
$firstFieldParams['opt'] = '';
$firstFieldParams['value2'] = '';
$firstFieldParams['not'] = false;
// create control
$ctrlBlockArr = $searchControlBuilder->buildSearchCtrlBlockArr($id, $firstFieldParams['fName'], 0, $firstFieldParams['opt'], $firstFieldParams['not'], false, $firstFieldParams['value1'], $firstFieldParams['value2']);

$xt->assign_section("work_field_label","<label for=\"".GetInputElementId("work_field", $id)."\">","</label>");
$xt->assign("work_field_label", true);

$xt->assign("work_field_fieldblock", true);
$xt->assignbyref("work_field_editcontrol", $ctrlBlockArr['searchcontrol']);
$xt->assign("work_field_notbox", $ctrlBlockArr['notbox']);
// create second control, if need it
$xt->assignbyref("work_field_editcontrol1", $ctrlBlockArr['searchcontrol1']);
// create search type select
$xt->assign("searchtype_work_field", $ctrlBlockArr['searchtype']);
$isFieldNeedSecCtrl = $searchControlBuilder->isNeedSecondCtrl("work_field");
$ctrlInd = 0;
if ($isFieldNeedSecCtrl)
$pageObject->controlsMap["search"]["searchBlocks"][] = array('fName'=>"work_field", 'recId'=>$id, 'ctrlsMap'=>array(0=>$ctrlInd, 1=>($ctrlInd+1)));
$pageObject->controlsMap["search"]["searchBlocks"][] = array('fName'=>"work_field", 'recId'=>$id, 'ctrlsMap'=>array(0=>$ctrlInd));
New php-forum User
New php-forum User
Posts: 1
Joined: Mon May 07, 2012 4:43 am

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.