it makes sense to return count instead of just selecting rows and returning them back. Also take a look at the queryDB implementation. I think by default it returns array of arrays. Basically to access the first column value in the first row you will require $resutl[0][0] . There should be an argument you can pass into queryDB which will only return the first row, so that you will be able to use $result[0] instead of multi-dimensional array.