<?php
$value = $res['id'];
$selectquery2 = " select id,name from table where id = '$value'";
$resu2 = $database->query($selectquery2);
if ($res2 = mysqli_fetch_array($resu2)) { ?>
<td name="id"><?php echo $res2['name']; ?></td>
<?php }
?>