Hi all this is my 1st post here
i am new to php and specially to OOP, i am a search class to get info from data base, i.e by category id, the problem is that, if inside the method i tried to return an array of values, i only get info from one
row but if i used echo inside the method, i get info from all rows

this is my part of class code
Select Code
PHP Code:
    private function jobs_by_category($category_id)
    {
        
$category_id $this->category_id;
        
$database = new Mysql_database();
        
$query "SELECT * FROM jobs j ";
        
$query .= "INNER JOIN categories c ";
        
$query .= "ON j.category_id = c.id ";
        
$query .= "INNER JOIN company_owners co ";
        
$query .= "ON j.company_id = co.id ";
        
$query .= "WHERE category_id = '{$category_id}'";
        
        
$result $database->database_query($query);
        return 
$result;
    } 
this is mysql query code
PHP Code:
    function display_jobs_by_category()
    {
        
$result $this->jobs_by_category($this->category_id);
        while (
$row mysql_fetch_array($result))
        {
            
            
$job_category $row['category_title'];
            
$job_title    =    $row['job_title'];
            
$job_company =    $row['company_title'];

            return 
$job_category.$job_title.$job_company;  //if i used echo here i get info from 
all rows!!!! 
        }
    } 
and the last thing here is my code to instiate an object
PHP Code:
    if ($Job->company_name != '')
    {
        
$job_by_company     =     $Job->display_jobs_by_company();
        echo 
$job_by_company['title'];
    } 

i used return before in procedual code and it worked ok, now i can only echo in method, and i want to return values only inside the method to customize the layout later...

thanks for any help....