Your query isn't restricting the search to a particular row.
You need to say something like this:
$query = "SELECT aircraftreg FROM jobdetails where aircraftreg = $aircraftreg";
$res = mysql_query ($query, $db);
Then, since you are only asking for the same column you're matching on, you don't really need to retrieve the row--simply asking for the count of matching records will do:
if (! $res)
echo "query failed--programming error?";
elseif (mysql_num_rows($res) == 1)
header ("Location: history.php?aircraftreg=$aircraftreg");
else
header ("Location: add_cust.php");
Note that your original comparison:
if ($aircraftreg == $row[2])
could never work because you're comparing to the 3rd column
of the results, but you only ask for a single column so the only
element of $row that will have any data is $row[0].