Hello everyone,

Hopefully this is a quick one, I need help with the following code:

PHP Code:
<select name="town" id="county">
    <option value=""></option>
    <?php $data $conn->query("SELECT CDV.id, CDV.name, gTowns.gtID, gCounties.id FROM CDV LEFT JOIN gTowns ON CDV.town=gTowns.gtID LEFT JOIN gCounties ON gTowns.county=gCounties.id ORDER BY name ASC");
    while (
$row $data->fetch(PDO::FETCH_ASSOC)){ ?>
        <option value="<?php echo $row['id']; ?>"><?php echo $row['name'].' ('.$towns[$row['gtID']].', '.$counties[$row['id']].')'?></option>
    <?php ?>
</select>
This is my question:

Here
PHP Code:
<option value="<?php echo $row['id']; ?>">
The code is supposed to display the id from the CDV table and it is displaying the id from the gCounties instead (both tables have an "id" column).

Is there a way I can tell php that I want the id from x table displayed instead of the other one?

Thanks for any help provided