Query for select God from God table
$sth =$dbh->prepare("SELECT god_id,god_name_ml,god_name_en,image,info_ml,info_en,details_ml,
details_en,rounds_ml,rounds_en,mantra_ml,mantra_en,display_order FROM god");
$sth->execute();
Query for select deity from deity table.Here god_id is the foreign key from god table
$stmt = $dbh->prepare("SELECT deity_id,god_id,deity_name_ml,deity_name_en,info_ml,info_en,details_ml,
details_en,mantra_ml,mantra_en,display_order FROM deity
WHERE deity_id = :deity_id");
$stmt->bindValue(':deity_id',$deity_id,PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetchAll();
$temp_array=$result[0];
$god_id=$temp_array['god_id'];
display code for displaying god in dropdown from god table
<?php while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?php echo $row['god_id'];?>">
<?php echo $row['god_name_en']; ?>
</option>
<?php } ?>
</option>
</select>
what I need is, in dropdown list the given god_id in god table is present in deity table make it as selected. only I need is selected Id's are selected