Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Apr 2007
    Thanked 0 Times in 0 Posts

    Urgent: Duplicate entries and unique indexes

    I have a problem with www.jssolomon.com

    I used the PHP forum to help start the site, and now I need some MYSQL help. Here's the problem: After people submit an entry, if they hit refresh, the same entry gets submitted again. I'm trying to get rid of and prevent such duplicate entries. I have gathered that the key to doing this is to create a unique index for the column that holds the text of each entry. So...I tried to do that:

    CREATE UNIQUE INDEX index_name ON table_name (column_name(100))

    But this didn't work. I got the error: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE CONCAT_WS( "-", secret(100 )"

    I also tried adding an index through the phpmyadmin interface. I used the following values:
    Index type: Unique
    Field: Secret (the column that holds the text entries)
    size: 100 (I want the first 100 characters to be in the index).

    I get the same error.

    So...what do I do? I'm using phpMyAdmin and my server is running mysql 4.0something. I suppose there is another way I could go about preventing duplicate entries by checking to see if it already exists before inserting it...but is this the best technique? Thanks in advance everyone, I appreciate the help.


    Edit: Also, as I try to go through my table and delete duplicate entries manually from phpMyAdmin, I occasionally get the following error: "Fatal error: Call to undefined function: pma_dbi_try_query() in /usr/local/apache/htdocs/phpMyAdmin-2.6.3/libraries/check_user_privileges.lib.php on line 16"
    Anyone know whatsup?
    Last edited by jsolomon; 04-11-2007 at 04:07 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts