PDO4You\PDO4You::selectNum PHP Method

selectNum() public static method

Method referring to the fetchAll(PDO::FETCH_NUM)
public static selectNum ( string $sql, string $use = null ) : array
$sql string Instruction SQL of query of records
$use string OPTIONAL Name of the database defined as a new connection instance
return array Returns an array indexed by column number
    public static function selectNum($sql, $use = null)
    {
        return self::selectRecords($sql, 'num', $use);
    }

Usage Example

Beispiel #1
0
 public function testAllTypesSelects()
 {
     // SQL query
     $sql = 'SELECT * FROM users';
     // Executes the SQL and stores the result
     $result = test::select($sql);
     $this->assertEquals(1, self::getNumRows($result));
     // Executes the SQL and stores the result
     $result_num = test::selectNum($sql);
     $this->assertEquals(1, self::getNumRows($result_num));
     // Executes the SQL and stores the result
     $result_obj = test::selectObj($sql);
     $this->assertEquals(1, self::getNumRows($result_obj));
     // Executes the SQL and stores the result
     $result_all = test::selectAll($sql);
     $this->assertEquals(1, self::getNumRows($result_all));
 }
All Usage Examples Of PDO4You\PDO4You::selectNum