I've the next code:

<?php 

$code = $_POST['code'];   // textbox
$con = mysql_connect("***","****","****");
if (!$con)
{  
    die('Server overload, please try again' . mysql_error());
}

mysql_select_db("example", $con);

$sql = mysql_query("SELECT code FROM exampletable");

while ($version = mysql_fetch_array($sql))
{

     // do something

}

mysql_close($con);      

?>

Things I want this code to complete is check the need for an textbox then search the column code during my MySQL database to search for any matches. If you will find any matches I wish it to look into the column referred to as 'version' and when 'version' is equivalent to 1 then execute another bit of code.
I am pretty a new comer to MySQL and also the MySQL/Database side of PHP and so i know this can most likely be a simple question for producing to reply to, so could anybody offer guidance?

Thanks,
Lawrence

you have to compare values using SQL, not PHP iterating over whole table. That is what SQL came to be for.

$code = mysql_real_escape_string($code); 
$sql = "SELECT code FROM exampletable WHERE code='$code' and version = 1"; 
$res = mysql_query($sql);
if (mysql_num_rows($res)) {
  echo "exact code found!";
} else {
  echo "not found";
}