Hello,
I was wondering if their is a more efficient way to write the code below. It lists the results ($id and $url) in the order of $link[1] then $link[2] then $link[3]. The trick is I only want to use the 1 select statement
$link[1] = 253;
$link[2] = 201;
$link[3] = 272;
$sql = "SELECT * FROM db WHERE id = \"".$link[1]."\" OR id = \"".$link[2]."\" OR id = \"".$link[3]."\"";
$rs = mysql_query($sql,$conn);
$i=1;
while($row = mysql_fetch_array($rs)) {
$id[$i] = $row['id'];
$url[$i] = $row['url'];
$i++;
}
$i=1;
foreach($id as $a){
if($a == $link[1]){echo "id - $id[$i] , url - $url[$i] <br>";}
$i++;
}
$i=1;
foreach($id as $a){
if($a == $link[2]){echo "id - $id[$i] , url - $url[$i] <br>";}
$i++;
}
$i=1;
foreach($id as $a){
if($a == $link[3]){echo "id - $id[$i] , url - $url[$i] <br>";}
$i++;
}