テーブルの列数を取る例
<?php
//autoloadの位置は適宜修正してください
require '../vendor/autoload.php';
use Laminas\Db\Adapter\Adapter;
$db = new Adapter([
'driver' => 'Pgsql', //postgresを使う場合
'host' => 'localhost',
'database' => db名,
'username' => ユーザID,
'password' => パスワード
]);
$stm = $db->createStatement("SELECT COUNT(*) FROM item");
echo $stm->execute()->current()['count'];