jeff5656 Posted March 10, 2008 Share Posted March 10, 2008 Before inserting a record into a table, I want to check to make sure a record with the same "id_incr" does not exist. The following code "tries" to do that, but it doesn't work. $patient_name = $_POST['patient_name']; $mrn = $_POST['mrn']; $fellow = $_POST['fellow']; $rcf_date = $_POST['rcf_date']; $consult_reason = $_POST['consult_reason']; $impression = $_POST['impression']; $recs = $_POST['recs']; $followup_reason = $_POST['followup_reason']; $followup_date = $_POST['followup_date']; $id_incr = $_POST['id_incr']; $check_dup = "SELECT id_incr FROM followup"; mysql_query ($check_dup) or die (mysql_error()); */ do I put an IF statement here now? Quote Link to comment Share on other sites More sharing options...
frijole Posted March 10, 2008 Share Posted March 10, 2008 in your table just set that value to auto_increment and unique. it wont ever be the same. Quote Link to comment Share on other sites More sharing options...
jeff5656 Posted March 10, 2008 Author Share Posted March 10, 2008 No I want to make sure that the record with id_incr is not inserted in the table twice (like a user who submits the same patient twice). If I set it to auto-increment, then that number will be different, but the record will indeed be a duplicate.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.