fetchColumn() public method

Returns an array containing one column from the result set rows
public fetchColumn ( string $sql, array $params = [] ) : array
$sql string SQL query with placeholders "SELECT id FROM users WHERE ip = :ip"
$params array params for query placeholders (optional) array (':ip' => '127.0.0.1')
return array
Esempio n. 1
0
 /**
  * fetchColumn
  */
 public function testFetchColumn()
 {
     $result = $this->db->fetchColumn("SELECT id FROM test LIMIT 10");
     $this->assertEquals(10, sizeof($result));
 }