you cant do if else statement in queries you have to use the WHERE clause to search for matching records - you can query in a loop say -- put the statement itself in a while loop and change the value of $i so that on every iteration you are looking
$qry = "SELECT * FROM myTable WHERE id = '".$i."'";
kind of thing..
or heres a trick -- you are looking for a non-linear set of 'id' s you can create an array of the id's your looking for and use a foreach loop as the input for your 'dynamic' 😉 query statement ..
$myarray = { 1,3,5,6,10,10009,2300,123901}
foreach ($myarray as $i){
$qry = "SELECT * FROM myTable WHERE id = '".$i."'";
....
}
good luck