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


PHP JDatabase::loadResult方法代码示例

本文整理汇总了PHP中JDatabase::loadResult方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabase::loadResult方法的具体用法?PHP JDatabase::loadResult怎么用?PHP JDatabase::loadResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDatabase的用法示例。


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

示例1: getNextOrder

 /**
  * Method to get the next ordering value for a group of rows defined by an SQL WHERE clause.
  * This is useful for placing a new item last in a group of items in the table.
  *
  * @param   string  $where  WHERE clause to use for selecting the MAX(ordering) for the table.
  *
  * @return  mixed  Boolean false an failure or the next ordering value as an integer.
  *
  * @link    http://docs.joomla.org/JTable/getNextOrder
  * @since   11.1
  */
 public function getNextOrder($where = '')
 {
     // If there is no ordering field set an error and return false.
     if (!property_exists($this, 'ordering')) {
         $e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_CLASS_DOES_NOT_SUPPORT_ORDERING', get_class($this)));
         $this->setError($e);
         return false;
     }
     // Get the largest ordering value for a given where clause.
     $query = $this->_db->getQuery(true);
     $query->select('MAX(ordering)');
     $query->from($this->_tbl);
     if ($where) {
         $query->where($where);
     }
     $this->_db->setQuery($query);
     $max = (int) $this->_db->loadResult();
     // Check for a database error.
     if ($this->_db->getErrorNum()) {
         $e = new JException(JText::sprintf('JLIB_DATABASE_ERROR_GET_NEXT_ORDER_FAILED', get_class($this), $this->_db->getErrorMsg()));
         $this->setError($e);
         return false;
     }
     // Return the largest ordering value + 1.
     return $max + 1;
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:37,代码来源:table.php

示例2: count

 /**
  * Count items.
  *
  * @return int
  */
 public function count()
 {
     $query = clone $this->query;
     $this->build($query);
     $query->select('COUNT(*)');
     $this->db->setQuery($query);
     $count = (int) $this->db->loadResult();
     KunenaError::checkDatabaseError();
     return $count;
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:15,代码来源:finder.php

示例3: getNextOrder

 /**
  * Returns the ordering value to place a new item last in its group
  *
  * @access public
  * @param string query WHERE clause for selecting MAX(ordering).
  */
 function getNextOrder($where = '')
 {
     if (!in_array('ordering', array_keys($this->getProperties()))) {
         $this->setError(get_class($this) . ' does not support ordering');
         return false;
     }
     $query = 'SELECT MAX(ordering)' . ' FROM ' . $this->_tbl . ($where ? ' WHERE ' . $where : '');
     $this->_db->setQuery($query);
     $maxord = $this->_db->loadResult();
     if ($this->_db->getErrorNum()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     return $maxord + 1;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:21,代码来源:table.php

示例4: indexExists

 /**
  * Controlla l'esistenza di un indice in una tabella
  * @param string $tablename
  * @param string indexname 
  * @return boolean TRUE se esiste, FALSE se non esiste
  */
 public function indexExists($tablename, $indexname)
 {
     $q = "SHOW INDEX FROM `" . $this->replacePrefix($tablename) . "` WHERE Key_name='" . $indexname . "'";
     $this->db->setQuery($q);
     return $this->db->loadResult() != null;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:12,代码来源:ProPayment_Database.php

示例5: loadResult

 /**
  * This method loads the first field of the first row returned by the query.
  *
  * @return string|null  The value returned in the query or null if the query failed.
  *
  * @throws  \RuntimeException
  */
 public function loadResult()
 {
     return $this->_db->loadResult();
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:11,代码来源:CmsDatabaseDriver.php

示例6: getPagination

 public function getPagination($total = null)
 {
     if (empty($total)) {
         $this->db->setQuery('SELECT count(*)' . ' FROM #__acctexp_' . $this->table . $this->getConstraints());
         $total = $this->db->loadResult();
     }
     return new bsPagination($total, $this->state->limitstart, $this->state->limit);
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:8,代码来源:admin.acctexp.php

示例7: queryResult

 /**
  * Execute a query to the database and load the result returned
  *
  * The result returned by this method is the same as the one returned by JDatabase::loadResult()
  * Basically, it returns the result (single field) of a database operation
  * Generally used for SELECT field operations
  *
  * @param string $query The query to be executed
  *
  * @return mixed The result of the query
  *
  * @throws RuntimeException
  *
  * @since 1.0.0
  */
 public function queryResult($query)
 {
     // query database table
     $this->_database->setQuery($query);
     return $this->_database->loadResult();
 }
开发者ID:JBZoo,项目名称:Zoo-Changelog,代码行数:21,代码来源:database.php

示例8: listRecords


//.........这里部分代码省略.........
		}

		if(JFactory::getSession()->get('bfStatus', '') == 'exported')
		{
			$ands .= "record.exported = 1 And";
		}
		else
		if(JFactory::getSession()->get('bfStatus', '') == 'archived')
		{
			$ands .= "record.archived = 1 And";
		}
		else
		if(JFactory::getSession()->get('bfStatus', '') == 'viewed')
		{
			$ands .= "record.viewed = 1 And";
		}

		if($ands != '')
		{
			$ands = 'Where ' . substr($ands,0,strlen($ands)-4);
		}

		$limiter = " Limit $offset, $limit";
		if($limit == 0)
		{
			$limiter = '';
		}

		$this->db->setQuery("Select Distinct SQL_CALC_FOUND_ROWS record.* From #__facileforms_records As record $subs $ands Order By record.".JRequest::getWord('orderBy','submitted')." ".(JRequest::getWord('order','DESC') == 'DESC' ? 'ASC' : 'DESC').$limiter);
		$rows = $this->db->loadObjectList();
                
		//echo $this->db->getQuery();
		$this->db->setQuery("SELECT FOUND_ROWS();");
		$foundRows = $this->db->loadResult();
                jimport('joomla.html.pagination');
		$pagination = new JPagination($foundRows, $offset, $limit);

		$this->db->setQuery("Select Distinct form As id, `name`, title From #__facileforms_records Order By title");
		$forms = $this->db->loadObjectList();
		$size = count($forms);
		$formsArray = array();
		for($i = 0;$i < $size;$i++)
		{
			if(!isset($formsArray['_'.$forms[$i]->id])){
				$formsArray['_'.$forms[$i]->id] = $forms[$i];
			}
		}

                $forms = $formsArray;
                ?>
<script type="text/javascript">
var bf_submitbutton = function(pressbutton)
			{
				var form = document.adminForm;
				switch (pressbutton) {
					case 'remove':
					case 'exportCsv':
					case 'exportXls':
					case 'exportPdf':
					case 'exportXml':
						if (form.boxchecked.value==0) {
							alert("<?php echo BFText::_('COM_BREEZINGFORMS_RECORDS_PLSSELECTRECS'); ?>");
							return;
						} // if
						form.exportt.value = 1;
						break;
开发者ID:rkern21,项目名称:videoeditor,代码行数:67,代码来源:recordmanagement.class.php

示例9: store

 /**
  * Inserts a new row if id is zero or updates an existing row in the database table
  *
  * Can be overloaded/supplemented by the child class
  *
  * @access public
  * @param boolean If false, null object variables are not updated
  * @return null|string null if successful otherwise returns and error message
  */
 function store($updateNulls = true)
 {
     $k = $this->_tbl_key;
     $wheres = array();
     // execute query and retrieve result
     $query = $this->_db->getQuery(true);
     $query->select(' 1 ');
     $query->from(' ' . $this->_db->quoteName($this->_tbl) . ' ');
     // check whether all fields are filled and build where statement
     for ($i = 0; $i < count($k); $i++) {
         if ($this->{$k}[$i] === null) {
             $this->setError(get_class($this) . '::store failed - primary key ' . $this->{$k} . ' is empty (null)');
             return false;
         } else {
             $wheres[] = ' ' . $this->_db->quoteName($k[$i]) . ' = ' . $this->_db->Quote($this->{$k}[$i]) . ' ';
         }
     }
     foreach ($wheres as $where) {
         $query->where($where);
     }
     $this->_db->setQuery($query);
     $result = $this->_db->loadResult();
     // if query has no result, record does not exists yet and is added here
     // if query has result, record exists and is updated here
     if (!$result) {
         $ret = $this->_db->insertObject($this->_tbl, $this);
     } else {
         $query->clear();
         $query->update($this->_db->quoteName($this->_tbl));
         $sets = array();
         foreach ($this->getProperties() as $name => $value) {
             if (is_array($value) or is_object($value) or $name[0] == '_') {
                 // internal or NA field
                 continue;
             }
             if (in_array($name, $k)) {
                 // PK not to be updated
                 continue;
             }
             if ($value === null) {
                 if ($updateNulls) {
                     $val = 'NULL';
                 } else {
                     continue;
                 }
             } else {
                 //$val = $this->_db->isQuoted( $name ) ? $this->_db->Quote( $value ) : (int) $value;
                 $val = $this->_db->Quote($value);
             }
             $sets[] = $this->_db->quoteName($name) . '=' . $val;
         }
         if (count($sets) > 0) {
             foreach ($sets as $set) {
                 $query->set($set);
             }
             foreach ($wheres as $where) {
                 $query->where($where);
             }
             $this->_db->setQuery($query);
             $ret = $this->_db->query();
         } else {
             $ret = true;
         }
     }
     if (!$ret) {
         $this->setError(get_class($this) . '::store failed - ' . $this->_db->getErrorMsg());
         return false;
     } else {
         return true;
     }
 }
开发者ID:Lothurm,项目名称:J3.x,代码行数:80,代码来源:JMFPKtable.php


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