# Problem with select statement using OOP in PHP

**URL:** <https://forum.kirupa.com/t/problem-with-select-statement-using-oop-in-php/294310>\
**Category:** programming\
**Created:** [August 12, 2009, 9:39am UTC](https://forum.kirupa.com/t/problem-with-select-statement-using-oop-in-php/294310 "2009-08-12T09:39:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![utsav](https://avatars.discourse-cdn.com/v4/letter/u/e19b73/32.png) [@utsav](https://forum.kirupa.com/u/utsav)\
**Post date:** [August 12, 2009, 9:39am UTC](https://forum.kirupa.com/t/problem-with-select-statement-using-oop-in-php/294310/1 "2009-08-12T09:39:57Z")

</div>

Well i am trying to get the number of rows that match the criteria in the table. Here is my code. It shows nothing. someone please help me asap. Well i modified the code that i made for fetching data. I dunno where i went wrong. I am amateur to OOP .

```php

<?php

$conn=mysql_connect('localhost','root','') or die("Could not connect to server.");
$db=mysql_select_db("career",$conn) or die("Database recess not found.");

class Database
{
    public function selects($table, $rows, $where)
    {
        $q = 'SELECT '.$rows.' FROM '.$table;
        if($where != NULL)
            $q .= ' WHERE '.$where;
        

        $query = @mysql_query($q);
        $counts = @mysql_num_rows($query);
        return $counts;
        
    }
    public function getResult()
    {
        return $this->result;
    }
} 

    $show = new Database();
        $show->selects("jobs","id","`city` = 'Nepalgunj'");
    $show->getResult();

?>

```
