如何调用名称而不是id?

Help don't know how to call the name of the position, My problem is my codition because when I change it to a position like 'Commissioner' it won't work but when I change to its id it will work but I want that my codition will be the name of the position, Please need help how to change this to a name: $dsds mean the id of the position

data struct example

<?php
include ('../connection/connect.php');

$result = $db->prepare("SELECT * FROM candposition ORDER BY posid ASC");
$result->bindParam(':userid', $res);
$result->execute();

for ($i = 0; $row = $result->fetch(); $i++) {

    $dsds = $row['posid'];

    for ($i = 0; $rows = $results->fetch(); $i++) {

        if ($dsds == '9012') {

            $result = $db->prepare("SELECT * FROM program ORDER BY progid ASC");

            echo $rows['progid'];
            echo '<br />';
            echo '<div  style = "margin-left:2px;display:inline-block;position:relative;">';
            echo '<img src="candidates/images/' . $rows['image'] . '" width="90" height="100px" />' . ',&nbsp;' . '<br />' . $rows['lastname'] . ',&nbsp;' . $rows['firstname'] . '<br />' . '&nbsp;=&nbsp;' . $rows['votes'];
            echo '<br />';
        }
    }
}

instead of : if ($dsds == '9012'){ add : if ($row[1]== 'Commissioner')