使用以下条件从数据库中选择值

<select name="sample" class="form-control" id='select'>
  <?php 
    $sam1="attingal"; $sam2="kollam"; 
    $getstd="SELECT stdid,firstname,lastname FROM student WHERE centre='$sam1' AND centre='$sam2' ORDER BY firstname ASC"; 
    $qs=$conn->query($getstd); 
    $qs->setFetchMode(PDO::FETCH_NUM); 
    while($getstd=$qs->fetch()) { 
  ?>
    <option value='<?php echo $getstd[0]; ?>'>
      <?php echo $getstd[1]." ".$getstd[2]; ?>
    </option>
    <?php } ?>
</select>

Nothing is displaying when I run the above code

Your problem is here:

WHERE centre='$sam1' AND centre='$sam2'

That condition can never be true. a field can't hold 2 different values at once. You supposedly wanted OR, so change it to

WHERE centre='$sam1' OR centre='$sam2'