<?php // Quick and simple single row + column $count = current($db->query('SELECT COUNT(*) FROM table')->fetch()); ?>