Welcome, Guest
  • Author Topic: Duplicate Rows checking  (Read 1331 times)

    afatmagic

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Duplicate Rows checking
    « on: 11/22/06, 02:00 »
    Hi All,

    I am new to PHP, and I am not building a website with PHP and mySQL. :-\

    I have built the product registration system for the end user, they need to key in the serial number, and I have try to check for duplicates from mysql DB using "mysql_num_rows".

    The problem is that, I totally got >190000 serial numbers need to be insert into the table, so it will over the table row limit? So how can I do this checking? Is there any other method to do the checking?

    Thank all!!

    Afat

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Duplicate Rows checking
    « Reply #1 on: 11/22/06, 02:08 »
    190000 is not a big deal for a table (thay can handle millons of rows), just do a:

    SELECT Key where id=someid

    If you get more than one row (trough mysql_num_rows), then it's a duplicate entry.
    if you have duplicate base data, set the id column as unique or primary key, duplicate insertion will fail

    Jorge

    afatmagic

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Re: Duplicate Rows checking
    « Reply #2 on: 11/22/06, 05:24 »
    Thx Jorge!  ;)

    And one more question, I would like to know what is the limit if the row numbers for table? Since the number may raise for a big number each month, I am afaid the table will be overlimit after few months? ???

    Thanks,
    Carmen

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Duplicate Rows checking
    « Reply #3 on: 11/22/06, 05:53 »
    Don't know exactly (the size for a table is in bytes, not in how many rows), check in mysql.com

    Jorge

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Duplicate Rows checking
    « Reply #4 on: 11/22/06, 17:17 »
    just imagine you would create 1 record every second - then it will outrun the limit in 5 years.
    In this time you have deleted records and then you can reorganize the record numbers.
    happy flashing
    8)
    Ronald