MySQL::QuerySingleRowArray PHP Method

QuerySingleRowArray() public method

Executes the given SQL query and returns the first row as an array
public QuerySingleRowArray ( string $sql, integer $resultType = MYSQLI_BOTH ) : array
$sql string The query string should not end with a semicolon
$resultType integer (Optional) The type of array Values can be: MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH
return array An array containing the first row or FALSE if no row is returned from the query
    public function QuerySingleRowArray($sql, $resultType = MYSQLI_BOTH)
    {
        $this->Query($sql);
        if ($this->RowCount() > 0) {
            return $this->RowArray(null, $resultType);
        } else {
            return false;
        }
    }

Usage Example

示例#1
0
文件: log.php 项目: vlhorton/color64
 public function lastCaller()
 {
     $db = new MySQL(true, 'color64', 'localhost', 'color64', 'nu5Jc4JdtZK4RCHH');
     $caller = $db->QuerySingleRowArray('SELECT `user_name` FROM `log` ORDER BY `id` DESC LIMIT 0,1');
     return $caller['user_name'];
 }
All Usage Examples Of MySQL::QuerySingleRowArray