Question: I have this table:

```
option_values table:
option_id (FK)
value_id (PK)
classified_id (FK)
value

```

example:

```
   option_id (FK)     value_id (PK)     classified_id (FK)     value
        1                  1                   22              'Petrol'
        2                  2                   22              'Manual'
        3                  3                   22              'Black'

```

How can I retrieve and echo every value found with the classified\_id=22 ?

I have tried this:

```
  $res=mysql_query("SELECT * FROM option_values WHERE classified_id=22");
  $row = mysql_fetch_row($res);
  echo $row[3]; // This displays 'Petrol'

```

But how can I also display the 'Manual', 'Black' etc?

Thanks

Answer: 
Use this, you need to get an array of rows...they way you are doing it is giving you a single row's value in an array.

```
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    printf("ID: %s  Value: %s", $row[0], $row[3]);  
}

```

Source: [here](http://www.php.net/manual/en/function.mysql-fetch-array.php)
```
 $res=mysql_query("SELECT * FROM option_values WHERE classified_id=22");
  while($row = mysql_fetch_array($res))
  {
    echo $row[1];
    echo $row[2];
    echo $row[3];
  }

```