cheers guys....
i have that sorted now, thanks.
Now i need to work out a way of manipulating the $id string if it matches one in the db.
<?
include("../include/functions.php");
accessdb();
$firstname = oliver;//FORM INPUT
$lastname = waring;
$id1 = substr($firstname,0,3);
$id2 = substr($lastname,0,3);
$formid = ($id1.$id2);//AUTO ID FROM FORM
$idquery = "SELECT * FROM crew WHERE id='$formid'";
$result = mysql_query($idquery)
or die ("Couldn't execute id query.");
$row = mysql_fetch_array($result);// COMPARE FORMID
if($row == TRUE)
{$id = ($formid.+1);} //IF MATCH ADD 1
else
{$id = $formid;}//IF NO MATCH ID = FORMID
echo $id;
?>
what i have written adds a 1 to the end of the string, however i found that when you continue with similar entries you get
abcxyz
abcxyz1
abcxyz11
abcxyz111
etc
i want the integer at the end of the string to increase each time ie
abcxyz
abcxyz1
abcxyz2
abcxyz3
any ideas?