Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8738053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:39:40+00:00 2026-06-13T10:39:40+00:00

How do i allow duplicate entries in my php file from this file …

  • 0

How do i allow duplicate entries in my php file from this file … i have the html file which is a form to track radios for a company. I have text boxes and radio buttons and all the fields need to be able to have duplicate entries except for the serial number field. i keep getting and error saying i cannot have duplicate entries.

<?php
    $con = mysql_connect("localhost","Jason","");
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("test", $con);

    $sql="INSERT INTO test (
        firstname,
        lastname, 
        department,
        radiomodel,
        serialnumber,
        issuedate
    )
    VALUES(
        '$_POST[firstname]',
        '$_POST[lastname]',
        '$_POST[department]',
        '$_POST[radiomodel]',
        '$_POST[serialnumber]',
        '$_POST[issuedate]'
     )";

     if (!mysql_query($sql,$con))
     {
         die('Error: ' . mysql_error());
     }

     echo "1 record added";

     mysql_close($con);
     header( "refresh:150;url=testinput.php" );
?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:39:41+00:00Added an answer on June 13, 2026 at 10:39 am

    Your serialnumber is a primary key and thus you can not have duplicate values.

    You should remove the primary key from the serialnumber field and add in a new id column to put the primary key on this or use multiple columns together as the key, for example use firstname, lastname and date and serialnumber as the key.

    Really you should split this off into multiple tables though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: HTML Text Input allow only Numeric input I used this script function
Possible Duplicate: Validating Crontab Entries w/ PHP I have search everywhere, and my Regex
Possible Duplicate: Allow php sessions to carry over to subdomains How to setup user
Possible Duplicate: How can I only allow certain filetypes on upload in php? i'm
Apart from the fact that HashSet does not allow duplicate values, what is the
I have a set of elements/keys which I'm reading from two different config files.
I need to maintain column names, and not allow duplicate entries, while maintaining the
Are there any dictionary classes in the .NET base class library which allow duplicate
This tiny JavaScript, along with some CSS is supposed to prevent duplicate entries into
Why does java.util.Map.values() allow you to delete entries from the returned Collection when it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.