I am trying to get the MySQL id field to auto update itself when an item is deleted. However the below doesnt work.

When a user searches by name, then I need to grab the id of that name before I delete it and minus 1.

$name = $_POST['name'];

if ($_POST['id'].value.length == 0){
	$id = false;}
$id = $_POST['id'];}

$lowcase = strtolower($name);
$ucname = ucwords($lowcase);

if ($id = false){
$result = mysql_query("SELECT id FROM tuck WHERE item='$ucname'");
$id = mysql_fetch_array($result);}

mysql_query("DELETE FROM tuck WHERE item='$ucname'");
mysql_query("UPDATE tuck SET id=id-1 WHERE id >'$id'");

echo "Item '" . $ucname . "' deleted";

It did work briefly when i had

mysql_query("UPDATE tuck SET id=id-1 WHERE id >= '$id'");

but then that also -1 from the numbers below it as well.

Thanks for any help offered.

mysql_query("UPDATE tuck SET id=id--1 WHERE id >= '$id'");

you only had one "-" if you put two it automatically decreases by one each time regardless of the present state.