Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-26.11.1 | composer require openswoole/core:26.11.1
<?php OpenSwoole\Coroutine\PostgreSQLStatement->fieldCount(): int|false
Returns the number of fields, or false when the statement has no result.
Returns the number of fields (columns) in the result of the statement.
<?php
use OpenSwoole\Coroutine\PostgreSQL;
co::run(function()
{
$pg = new PostgreSQL();
$pg->connect("host=127.0.0.1 port=5432 dbname=test user=postgres password=***");
$stmt = $pg->query("SELECT id, text FROM test");
var_dump($stmt->fieldCount());
});