Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Help with mysql duplicate row

Help with mysql duplicate row

Scheduled Pinned Locked Moved Web Development
databasemysqlhelp
5 Posts 4 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Izu Great
    wrote on last edited by
    #1

    i have table in my database, which has theses fields id, regno, courseid, level, session, the regno can be inserted more than once as well as level and session, also courseid but with previous regno. i need to prevent duplicate rows with regno, courseid, level, session, on a row.

    Kornfeld Eliyahu PeterK Z S 3 Replies Last reply
    0
    • I Izu Great

      i have table in my database, which has theses fields id, regno, courseid, level, session, the regno can be inserted more than once as well as level and session, also courseid but with previous regno. i need to prevent duplicate rows with regno, courseid, level, session, on a row.

      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu Peter
      wrote on last edited by
      #2

      And how is it related to web development? Anyway - try distinct...

      I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

      I 1 Reply Last reply
      0
      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

        And how is it related to web development? Anyway - try distinct...

        I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

        I Offline
        I Offline
        Izu Great
        wrote on last edited by
        #3

        Thanks. I'm using it on php

        1 Reply Last reply
        0
        • I Izu Great

          i have table in my database, which has theses fields id, regno, courseid, level, session, the regno can be inserted more than once as well as level and session, also courseid but with previous regno. i need to prevent duplicate rows with regno, courseid, level, session, on a row.

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #4

          You have a couple of options. 1. Add a unique index so MySql will not allow it. 2. When you are inserting records first check to see if it exists already.

          There are only 10 types of people in the world, those who understand binary and those who don't.

          1 Reply Last reply
          0
          • I Izu Great

            i have table in my database, which has theses fields id, regno, courseid, level, session, the regno can be inserted more than once as well as level and session, also courseid but with previous regno. i need to prevent duplicate rows with regno, courseid, level, session, on a row.

            S Offline
            S Offline
            stevic
            wrote on last edited by
            #5

            You need to have Unique index in your table or Check before inserting anyway have you set an Increment ID ?

            Freelance makes perfect | http://codetrash.com

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups