But as it stands it constantly diverts to addsuccess.php even if the record already exists. It doesn't even give a duplicate error ;s
Code: Select all
<?php
include('../../connect.php');
include('../../functions.php');
$finduser="SELECT CitID FROM military WHERE CitID = '$_Post[ID]'";
$result=mysql_query($finduser);
$numrows = mysql_num_rows($result);
if($numrows > 0) {
header("location:../adderror.php");
} else {
$insertuser = "INSERT INTO military (CitID, Branch, Regiment, Position) VALUES ('$_POST[ID]','$_POST[Branch]','$_POST[Regiment]','$_POST[Position]')";
mysql_query($insertuser);
updatecitizen($_POST[ID]);
header("location:../addsuccess.php");
}
mysql_close();
?>