I have two queries like this:
$stm = $db->prepare(" SELECT * from table1 where word = :word ");
$stm->bindValue(':word', $word, PDO::PARAM_STR);
$stm->execute();
$iterator = 0;
while ($end = $stm->fetch()) {
foreach ($db-query(" SELECT * from table2 where id = $end['id']") as $row) {
echo $row['title'];
}
$iterator ++;
}
Now I want to know, is it possible to I write a sub-query instead of that separated query? In other word how can I write those two queries in one query?