Horde_Db_Adapter_Base::selectOne PHP Method

selectOne() public method

Returns a record hash with the column names as keys and column values as values.
public selectOne ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return array
    public function selectOne($sql, $arg1 = null, $arg2 = null)
    {
        $result = $this->selectAll($sql, $arg1, $arg2);
        return $result ? next($result) : array();
    }

Usage Example

Esempio n. 1
0
 /**
  * Returns an attribute information hash.
  *
  * @param integer $attribute_id  An attribute ID.
  *
  * @return array  The attribute hash.
  * @throws Whups_Exception
  */
 public function getAttributeDesc($attribute_id)
 {
     try {
         $attribute = $this->_db->selectOne('SELECT attribute_name, attribute_description, ' . 'attribute_type, attribute_params, attribute_required ' . 'FROM whups_attributes_desc WHERE attribute_id = ?', array((int) $attribute_id));
     } catch (Horde_Db_Exception $e) {
         throw new Whups_Exception($e);
     }
     return array('id' => $attribute_id, 'name' => $this->_fromBackend($attribute['attribute_name']), 'description' => $this->_fromBackend($attribute['attribute_description']), 'type' => empty($attribute['attribute_type']) ? 'text' : $attribute['attribute_type'], 'params' => $this->_fromBackend(@unserialize($attribute['attribute_params'])), 'required' => (bool) $attribute['attribute_required']);
 }
All Usage Examples Of Horde_Db_Adapter_Base::selectOne