当前位置: 首页>>代码示例>>PHP>>正文


PHP db_fetch_numarray函数代码示例

本文整理汇总了PHP中db_fetch_numarray函数的典型用法代码示例。如果您正苦于以下问题:PHP db_fetch_numarray函数的具体用法?PHP db_fetch_numarray怎么用?PHP db_fetch_numarray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_fetch_numarray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNextPrevRecordKeys


//.........这里部分代码省略.........
         } else {
             $nextExpr = "";
             $prevExpr = "";
             //	current field value is null
             if ($asc) {
                 $nextExpr = $fullName . " IS NOT NULL";
             } else {
                 $prevExpr = $fullName . " IS NOT NULL";
             }
             if ($i < count($orderClause->fieldsList) - 1) {
                 if ($nextExpr != "") {
                     $nextExpr .= " or ";
                 }
                 $nextExpr .= $fullName . " IS NULL";
                 if ($prevExpr != "") {
                     $prevExpr .= " or ";
                 }
                 $prevExpr .= $fullName . " IS NULL";
             }
         }
         if ($nextExpr == "") {
             $nextExpr = " 1=0 ";
         }
         if ($prevExpr == "") {
             $prevExpr = " 1=0 ";
         }
         // append expression to where clause
         if ($i > 0) {
             $where_next .= " AND ";
             $where_prev .= " AND ";
         }
         $where_next .= "(" . $nextExpr;
         $where_prev .= "(" . $prevExpr;
         $tail .= ")";
     }
     $where_next = $where_next . $tail;
     $where_prev = $where_prev . $tail;
     if ($where_next == "" or $order_next == "" or $where_prev == "" or $order_prev == "") {
         $_SESSION[$this->sessionPrefix . "_noNextPrev"] = 1;
         return;
     }
     //		make the resulting query
     if ($query === null) {
         return;
     }
     if (!$query->HasGroupBy()) {
         $oWhere = $query->Where();
         $where = whereAdd($where, $oWhere->toSql($query));
         $where_next = whereAdd($where_next, $where);
         $where_prev = whereAdd($where_prev, $where);
         $query->ReplaceFieldsWithDummies($this->pSet->getBinaryFieldsIndices());
         $sql_next = $query->toSql($where_next, $order_next);
         $sql_prev = $query->toSql($where_prev, $order_prev);
     } else {
         $oWhere = $query->Where();
         $oHaving = $query->Having();
         $where = whereAdd($where, $oWhere->toSql($query));
         $having = whereAdd($having, $oHaving->toSql($query));
         $query->ReplaceFieldsWithDummies($this->pSet->getBinaryFieldsIndices());
         $sql = "select * from (" . $query->toSql($where, "", $having) . ") prevnextquery";
         $sql_next = $sql . " WHERE " . $where_next . $order_next;
         $sql_prev = $sql . " WHERE " . $where_prev . $order_prev;
     }
     if (GetGlobalData("returnToActualListPage", false)) {
         if ($prevExpr == " 1=0 ") {
             $_SESSION[$this->sessionPrefix . "_pagenumber"] = 1;
         } else {
             $pageSQL = "select count(*) from (" . $sql_prev . ") tcount";
             $pageRes = db_query($pageSQL, $conn);
             $pageRow = db_fetch_numarray($pageRes);
             $currentRow = $pageRow[0];
             if ($this->pageSize > 0) {
                 $pageSize = $this->pageSize;
             } else {
                 $pageSize = $this->pSet->getInitialPageSize();
             }
             $this->myPage = floor($currentRow / $pageSize) + 1;
             $_SESSION[$this->sessionPrefix . "_pagenumber"] = $this->myPage;
         }
     }
     //	add record count options
     $sql_next .= " limit 1";
     $sql_prev .= " limit 1";
     $res_next = db_query($sql_next, $conn);
     if ($res_next) {
         if ($row_next = $this->cipherer->DecryptFetchedArray($res_next)) {
             foreach ($tKeys as $i => $k) {
                 $next[$i] = $row_next[$k];
             }
         }
         db_closequery($res_next);
     }
     $res_prev = db_query($sql_prev, $conn);
     if ($row_prev = $this->cipherer->DecryptFetchedArray($res_prev)) {
         foreach ($tKeys as $i => $k) {
             $prev[$i] = $row_prev[$k];
         }
     }
     db_closequery($res_prev);
 }
开发者ID:aagusti,项目名称:padl-tng,代码行数:101,代码来源:runnerpage.php

示例2: 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"]));
	}	
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:66,代码来源:addpage.php

示例3: db_gettablelist

function db_gettablelist()
{
	global $conn;
	$ret=array();
	$strSQL="select owner||'.'||table_name as name,'TABLE' as type from all_tables where owner not like '%SYS%'
                 union all
                 select owner||'.'||view_name as name,'VIEW' from all_views where owner not like '%SYS%'";
	$rs=db_query($strSQL,$conn);
	while($data=db_fetch_numarray($rs))
		$ret[]=$data[0];
	return $ret;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:12,代码来源:dbinfo.ora.php

示例4: db_connect

function db_connect() {
    global $connstr, $postgreDbVersion;
	$conn=pg_connect($connstr);
	if(!$conn)
		trigger_error("Unable to connect",E_USER_ERROR);
	
	$postgreDbVersion = "8";	
	$ret = pg_query("SELECT version()");
	$row = db_fetch_numarray($ret);
	if($row)
	{
		if(	preg_match("/^PostgreSQL\s(\d{1,2})\./", $row[0], $matches) )
			$postgreDbVersion = $matches[1];
	}	
	return $conn;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:16,代码来源:dbconnection.pg.php

示例5: db_gettablelist

function db_gettablelist()
{
	global $conn;
	$ret=array();
	$strSQL="select DATABASE() as dbname";
	$rs=db_query($strSQL,$conn);
	$data=db_fetch_array($rs);
	if(!$data)
		return $ret;
	$dbname=$data["dbname"];
	$query = db_query("SELECT VERSION() as mysql_version",$conn);
	$data=db_fetch_array($query);
	$server_info=0;
	if($data)
		$server_info=$data["mysql_version"];
	if($server_info>=5)
	{
		$strSQL="SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '".$dbname."'";
		$rs=db_query($strSQL,$conn);
		while($data=db_fetch_array($rs))
			$ret[]=$data["TABLE_NAME"];

		$strSQL="SELECT TABLE_NAME FROM information_schema.VIEWS WHERE TABLE_SCHEMA = '".$dbname."'";
		$rs=db_query($strSQL,$conn);
		while($data=db_fetch_array($rs))
			if(!in_array($data["TABLE_NAME"],$ret))
				$ret[]=$data["TABLE_NAME"];
		sort($ret);
	}
	else
	{
		$strSQL="SHOW tables";
		$rs=db_query($strSQL,$conn);
		while($data=db_fetch_numarray($rs))
			$ret[]=$data[0];
	}
	
	return $ret;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:39,代码来源:dbinfo.my.mysql.php

示例6: CrossTableReport

 function CrossTableReport($rpt_array)
 {
     global $conn;
     $this->xml_array = $rpt_array;
     $arrdata = array();
     $arravgsum = array();
     $arravgcount = array();
     $group_y = array();
     $group_x = array();
     $sort_y = array();
     $grid_row = array();
     $avgsumx = array();
     $avgcountx = array();
     $this->total_summary = 0;
     $this->is_value_empty = true;
     $this->table_type = $rpt_array["table_type"];
     if (!$this->table_type) {
         $this->table_type = "project";
     }
     if ($rpt_array["fromWizard"]) {
         $this->fromWizard = true;
     }
     $this->TableName = $this->xml_array["tables"][0];
     $this->pSet = new ProjectSettings(GetTableByShort($this->TableName), PAGE_REPORT);
     $sum_x = $this->xml_array["group_fields"][count($this->xml_array["group_fields"]) - 1]["sum_x"];
     $sum_y = $this->xml_array["group_fields"][count($this->xml_array["group_fields"]) - 1]["sum_y"];
     $sum_total = $this->xml_array["group_fields"][count($this->xml_array["group_fields"]) - 1]["sum_total"];
     if (postvalue("group_func") != "") {
         $_SESSION[$this->TableName . "_group_func"] = postvalue("group_func");
     }
     if (postvalue("field") != "") {
         $_SESSION[$this->TableName . "_field"] = postvalue("field");
     }
     if (postvalue("axis_x") != "") {
         $_SESSION[$this->TableName . "_gr_x"] = postvalue("axis_x");
     }
     if (postvalue("axis_y") != "") {
         $_SESSION[$this->TableName . "_gr_y"] = postvalue("axis_y");
     }
     if (postvalue("rname") != "") {
         $_SESSION[$this->TableName . "_rname"] = postvalue("rname");
     }
     $crtableSQL = $this->getstrSQL();
     $rs = db_query($crtableSQL, $conn);
     while ($data = db_fetch_numarray($rs)) {
         if (!in_array($data[1], $group_y)) {
             $group_y[] = $data[1];
             $sort_y[] = count($sort_y);
         }
         if (!in_array($data[2], $group_x)) {
             $group_x[] = $data[2];
             $this->col_summary["data"][count($group_x) - 1]["col_summary"] = "&nbsp;";
             $this->col_summary["data"][count($group_x) - 1]["id_col_summary"] = "total_x_" . (count($group_x) - 1);
         }
         for ($i = 0; $i < count($group_y); $i++) {
             if ($group_y[$i] == $data[1]) {
                 $key_y = $i;
             }
         }
         for ($i = 0; $i < count($group_x); $i++) {
             if ($group_x[$i] == $data[2]) {
                 $key_x = $i;
                 $avgsumx[$key_x] = 0;
                 $avgcountx[$key_x] = 0;
             }
         }
         if (!$this->is_value_empty) {
             $arrdata[$key_y][$key_x] = $data[0];
             $arravgsum[$key_y][$key_x] = $data[3];
             $arravgcount[$key_y][$key_x] = $data[4];
         } else {
             $arrdata[$key_y][$key_x] = "&nbsp;";
         }
     }
     global $group_sort_y;
     $group_sort_y = $group_y;
     usort($sort_y, array("CrossTableReport", "sort_arr_y"));
     $group_func = $_SESSION[$this->TableName . "_group_func"];
     $idx_field = $_SESSION[$this->TableName . "_field"];
     if (!$idx_field) {
         $idx_field = 0;
     }
     if ($group_func == "") {
         $arr_value = $this->getSelectedValue();
         if (empty($arr_value)) {
             $field = $_SESSION['webreports']['group_fields'][0]["name"];
             $arr_value[] = $field;
         } else {
             $field = $arr_value[$idx_field];
         }
         $group_func = $this->getGroupFunction($field, "");
     } else {
         $arr_value = $this->getSelectedValue();
         $field = $arr_value[$idx_field];
         $isGroupFuncExists = false;
         foreach ($this->xml_array["totals"] as $key => $value) {
             if ($this->FullFieldName($value["name"], $value["table"]) == $field) {
                 if ($value["sum"] == true && $group_func == "sum") {
                     $isGroupFuncExists = true;
                     break;
//.........这里部分代码省略.........
开发者ID:aagusti,项目名称:padl-tng,代码行数:101,代码来源:crosstable_report.php

示例7: WRGetTableListAdmin

function WRGetTableListAdmin($db_type)
{
	global $conn;
	$ret=array();
	$rs=db_query("select ".AddFieldWrappers("tablename").",".AddFieldWrappers("group_name")." from ".AddTableWrappers("webreport_admin")." where ".AddFieldWrappers("db_type")."='".$db_type."'",$conn);
	while($data = db_fetch_numarray( $rs )) 
		$ret[]=array("tablename"=>$data[0],"group"=>$data[1]);	
	return $ret;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:9,代码来源:reportfunctions.php

示例8: AddTableWrappers

//	show readonly fields
$linkdata = "";
if (@$_POST["a"] == "added" && $inlineadd == ADD_ONTHEFLY) {
    if (!$error_happened && $status != "DECLINED") {
        $LookupSQL = "";
        $linkfield = "";
        $dispfield = "";
        if ($LookupSQL) {
            $LookupSQL .= " from " . AddTableWrappers($strOriginalTableName);
        }
        $data = 0;
        if (count($keys) && $LookupSQL) {
            $where = KeyWhere($keys);
            $LookupSQL .= " where " . $where;
            $rs = db_query($LookupSQL, $conn);
            $data = db_fetch_numarray($rs);
        }
        if ($data) {
            $respData = array($linkfield => @$data[0], $dispfield => @$data[1]);
        } else {
            $respData = array($linkfield => @$avalues[$linkfield], $dispfield => @$avalues[$dispfield]);
        }
        $returnJSON['success'] = true;
        $returnJSON['keys'] = $keys;
        $returnJSON['vals'] = $respData;
        $returnJSON['fields'] = $showFields;
    } else {
        $returnJSON['success'] = false;
        $returnJSON['message'] = $message;
    }
    echo "<textarea>" . htmlspecialchars(my_json_encode($returnJSON)) . "</textarea>";
开发者ID:samsulpendis,项目名称:Instant_Appointment,代码行数:31,代码来源:Month_Billings_add.php

示例9: 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;
}
开发者ID:aagusti,项目名称:padl-tng,代码行数:63,代码来源:commonfunctions.php

示例10: gSQLRowCount_int

	static function gSQLRowCount_int($sqlHead, $sqlFrom, $sqlWhere, $sqlGroupBy, $sqlHaving, $where, $having, $criteria="or")
	{
		global $conn;
		global $bSubqueriesSupported;
		
		$strWhere=whereAdd($sqlWhere,$where);
		if(strlen($strWhere))
			$strWhere=" where ".$strWhere." ";
		
		if(strlen($sqlGroupBy))
		{
					if($bSubqueriesSupported)
			{
				$countstr = "select count(*) from (".SQLQuery::gSQLWhere_having($sqlHead,$sqlFrom,$sqlWhere,$sqlGroupBy, $sqlHaving,$where,$having,$criteria).") a";
			}
			else
			{
				$countstr = SQLQuery::gSQLWhere_having($sqlHead,$sqlFrom,$sqlWhere,$sqlGroupBy, $sqlHaving,$where,$having,$criteria);
				return GetMySQL4RowCount($countstr);
			}
		}
		else
		{
			$countstr = "select count(*) ".$sqlFrom.$strWhere;
		}
		$countrs = db_query($countstr, $conn);
		$countdata = db_fetch_numarray($countrs);
		return $countdata[0];
	}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:29,代码来源:sql.php

示例11: GetDatabaseType

			, $gQuery->Having()->toSql($gQuery), $where, $having);
	}
	
	if(GetDatabaseType() == 0 || GetDatabaseType() == 4) 
		$strSQL.= " LIMIT ".$numberOfSuggests;
	elseif(GetDatabaseType() == 2 || GetDatabaseType() == 3) 
		$strSQL = "select top ".$numberOfSuggests." * from (".$strSQL.") st";
	elseif(GetDatabaseType() == 1) 
		$strSQL = AddRowNumber($strSQL, $numberOfSuggests);
	elseif(GetDatabaseType() == -1)
		$strSQL = AddLimitFirebird($strSQL, 0, $numberOfSuggests);

	$rs = db_query($strSQL, $conn);
	
	// fill $response array with the field's suggest value
	while( ($row = db_fetch_numarray($rs)) && count($response) < $numberOfSuggests ) 
	{
		$val = $cipherer->DecryptField($f, $row[0]);
		if(IsGuid($fType))
			$val = substr($val, 1, -1);
		
		// "_" is added to conver number type to string
		if (!preg_match($pattern_clear_tags, $val)) // if not html tags
			$fieldControl->suggestValue("_".$val, $searchFor, $response, $row);
		else
			$response['_'.$val] = '_'.$val;
	}
}
db_close($conn);
ksort($response, SORT_STRING);
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:30,代码来源:searchsuggest.php

示例12: array

if( $denyChecking )
{
	$returnJSON = array("success" => false, "error" => "Duplicated values are allowed");
	echo "<div>".printJSON($returnJSON)."</div>";
	return;
}

$cipherer = new RunnerCipherer($tableName, $pSet);

if( $cipherer->isFieldEncrypted($fieldName) )
	$value = $cipherer->MakeDBValue($fieldName, $value, $fieldControlType, "", true);	
else
	$value = make_db_value($fieldName, $value, $fieldControlType, "", $tableName);

$where = GetFullFieldName($fieldName, $tableName, false).( $value == "null" ? ' is ' : '=' ).$value; 
$sql = "SELECT count(*) from ".AddTableWrappers( $pSet->getOriginalTableName() )." where ".$where;

$rs = db_query($sql, $conn);
if( !$rs || !($data = db_fetch_numarray($rs)) )
{
	$returnJSON = array("success" => false, "error" => "Error: Wrong SQL query");
	echo "<div>".printJSON($returnJSON)."</div>";
	return;
}

$hasDuplicates = $data[0] ? true : false;
$returnJSON = array("success" => true, "hasDuplicates" => $hasDuplicates, "error"=>"");	
echo "<div>".printJSON($returnJSON)."</div>";
return;
?>
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:30,代码来源:checkduplicates.php

示例13: CrossTableReport

	function CrossTableReport($rpt_array, $strSQL)
	{
		global $conn;
		$this->xml_array = $rpt_array;

		if( $rpt_array["table_type"] )
			$this->table_type = $rpt_array["table_type"];
		
		if( $rpt_array["fromWizard"] )
			$this->fromWizard = true;
		
		$this->tableName = $this->xml_array["tables"][0];
		
		$this->shortTableName = GetTableURL($this->tableName);
		if( strlen($this->shortTableName) == 0 )
			$this->shortTableName = $this->tableName;
			
		$this->pSet = new ProjectSettings($this->tableName, PAGE_REPORT);
		if( $this->fromWizard )
		{
			include_once getabspath("classes/controls/ViewControlsContainer.php");
			$this->viewControls = new ViewControlsContainer($this->pSet, PAGE_REPORT);
			$this->tableKeys = $this->pSet->getTableKeys();
		}

		$this->fillSessionVariables();


		$this->dataField = $this->getDataField( $_SESSION[$this->shortTableName."_field"] );
		if( !strlen($this->dataField) )
			$this->dataField = $_SESSION['webreports']['group_fields'][0]["name"];
		
		$this->initDataFieldSettings();
		$this->initDataGroupFunction($_SESSION[$this->shortTableName."_group_func"]);
		
				
		// assing index_field_x, index_field_y properties
		$this->setAxisFieldsIndices();
		
		$crtableSQL = $this->getstrSQL( $strSQL );
		$rs = db_query($crtableSQL, $conn);
		
		$group_y = array();
		$group_x = array();
		$sort_y = array();
		
		$arrdata = array();
		$arravgsum = array();
		$arravgcount = array();
		
		$avgsumx = array();
		$avgcountx = array();
		
		while($data = db_fetch_numarray($rs))
		{
			if( !in_array($data[1], $group_y) )
			{
				$group_y[] = $data[1];
				$sort_y[] = count($sort_y);
			}
			
			if( !in_array($data[2], $group_x) )
			{
				$group_x[] = $data[2];
				$this->col_summary["data"][ count($group_x) - 1 ]["col_summary"] = "&nbsp;";
				$this->col_summary["data"][ count($group_x) - 1 ]["id_col_summary"] = "total_x_".( count($group_x) - 1);
			}
			
			$key_y = array_search( $data[1], $group_y );
			
			$key_x = array_search( $data[2], $group_x );
			
			$avgsumx[ $key_x ] = 0;
			$avgcountx[ $key_x ] = 0;

			if( !$this->is_value_empty )
			{
				$arrdata[ $key_y ][ $key_x ] = $data[0];
				$arravgsum[ $key_y ][ $key_x ] = $data[3];
				$arravgcount[ $key_y ][ $key_x ] = $data[4];
			}
			else
				$arrdata[ $key_y ][ $key_x ] = "&nbsp;";
		}
		
		//	sort y groups
		global $group_sort_y;
		$group_sort_y = $group_y;
		SortForCrosstable($sort_y);
		
		
		foreach($sort_y as $key_y)
		{
			$value_y = $group_y[ $key_y ];
			$this->rowinfo[ $key_y ]["row_summary"] = "&nbsp;";
			$this->rowinfo[ $key_y ]["group_y"] = $this->getAxisDisplayValue($this->index_field_y, $value_y);
			
			foreach($group_x as $key_x => $value_x)
			{
				if( array_key_exists($key_y, $arrdata) )
//.........这里部分代码省略.........
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:101,代码来源:crosstable_report.php

示例14: GetRowCount

/**
 * 	get count of rows from the query
 * @intellisense
 */
function GetRowCount($strSQL)
{
	global $conn;
	$strSQL=str_replace(array("\r\n","\n","\t")," ",$strSQL);
	$tstr = strtoupper($strSQL);
	$ind1 = strpos($tstr,"SELECT ");
	$ind2 = my_strrpos($tstr," FROM ");
	$ind3 = my_strrpos($tstr," GROUP BY ");
	if($ind3===false)
	{
		$ind3 = strpos($tstr," ORDER BY ");
		if($ind3===false)
			$ind3=strlen($strSQL);
	}
	$countstr=substr($strSQL,0,$ind1+6)." count(*) ".substr($strSQL,$ind2+1,$ind3-$ind2);
	$countrs = db_query($countstr,$conn);
	$countdata = db_fetch_numarray($countrs);
	return $countdata[0];
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:23,代码来源:commonfunctions.php

示例15: 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;
	}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:30,代码来源:runnerpage.php


注:本文中的db_fetch_numarray函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。