Given that you have duplicate entries, then one field, or a combination of several fields, will probably be unique.
Before adding a record execute a SELECT, using the values from the form against that combination. If the number of records returned is greater than 0, then execute an UPDATE query, otherwise an INSERT.
Now, that information is so vague to be almost useless, for it begs a number of other questions, such as
How many questions are end users allowed to ask?
How are questions flagged for expiration or completion/solution?
What kind of mix of questions do you allow?
Cookies only store a bit of information on the user's browser. There's nothing magic about them - google for "netscape cookies". I don't think they'd be much help to you here.
HTH - Miles Thompson
At 01:13 PM 6/4/2003 -0700, chip.wiegand@simrad.com wrote:
I need to modify some company web pages that include a form for asking the company departments questions, such as service dept, etc. As the forms are currently built there is some field validation but no cookies. This info is saved in a mysql database, problem is, there are duplicate entries, every time an end-user posts a question. What kind of code do I need to add to these existing pages to prevent duplicate entries in the database? (Manually scanning through and deleting dupes is a real drag.) And what about cookies? Could I make use of these on these pages? I haven't worked with cookies yet, so am not sure where to start with that part. Thanks, -- Chip
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php