the problem I am having I will describe it as best as I can....The user chooses three selections and the image appears on the screen, and the selections they made are sent and stored in the database, the PHP function below then finds the image for the selection and returns them as variables so the latest selection they made and the images corresponding to the selection is still displayed in the placeholders after the page is refreshed, the SQL code I have below I want to incorporate into one Query but I need it so where the data for $driver1 is found it is placed into the $image1 variable and the same for $driver2 into $image2, and $driver3 to $img3 so I can return them to the page and echo the correct images in the correct placeholders. The images for the selections they made need to appear in the placeholders that they originally appeared in. It works fine as it is now, but I am sure that the SQL querys can be shortened to one? to save lines of code.
The code I have posted below is the main important bits so you can hopefully understand what I am asking.
Any help would be great, thank you.
//HTML CODE
<?php
list($img1, $img2, $img3) = checkteam();
?>
<img onclick="return removedriver1(this)" id="advert" src="images/delete.gif" border="0"/>
<img id="placeholder1" src="<?php echo "$img1";?>" alt="" />
<img onclick="return removedriver2(this)" id="advert src="images/delete.gif" border="0"/>
<img id="placeholder2" src="<?php echo "$img2";?>" alt="" />
<img onclick="return removedriver3(this)" id="advert" src="images/delete.gif" border="0"/>
<img id="placeholder3" src="<?php echo "$img3";?>" alt="" />
//PHP CODE
function checkteam(){
$sql="SELECT image FROM drivers WHERE drivers_id = '$driver1'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$image1=$row[image];
$sql="SELECT image FROM drivers WHERE drivers_id = '$driver2'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$image2=$row[image];
$sql="SELECT image FROM drivers WHERE drivers_id = '$driver3'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
$image3=$row[image];
return array ($image1, $image2, $image3);
}