fetchSingleRow() public method

$sql = 'SELECT * FROM user WHERE id = 123'; $user = $GLOBALS['dbi']->fetchSingleRow($sql); produces $user = array('id' => 123, 'name' => 'John Doe')
public fetchSingleRow ( string $query, string $type = 'ASSOC', object $link = null ) : array | boolean
$query string The query to execute
$type string NUM|ASSOC|BOTH returned array should either numeric associative or both
$link object mysql link
return array | boolean first row from result or false if result is empty
Ejemplo n.º 1
0
 /**
  * Returns the real row count for a table
  *
  * @return number
  */
 function getRealRowCountTable()
 {
     // SQL query to get row count for a table.
     $result = $this->_dbi->fetchSingleRow(sprintf('SELECT COUNT(*) AS %s FROM %s.%s', Util::backquote('row_count'), Util::backquote($this->_db_name), Util::backquote($this->_name)));
     return $result['row_count'];
 }