Re: address info, forms, maintanance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.

Do you mean that when I hit "submit" there are duplicate entries submitted
or that it may match what someone else has submitted and become duplicate?

If it's the second case, wouldn't that be optimal? You'd know that X people
had the same issue/question and you can reply to each one when it's
resolved...

> What kind of code do I need to
> add to these existing pages to prevent duplicate entries in the database?

Makeing the column unique is the easiest way. If you get a "duplicate" error
from mysql_error(), then just ignore it because the problem is apparently
accounted for.

> (Manually scanning through and deleting dupes is a real drag.)

No one does anything manually... :) Easiest way to "fix" your data now would
be to make a new table with UNIQUE columns where you need them. Then do an
INSERT INTO ... SELECT to move the data from one table to the other.
Duplicates will be ignored by the new table. Proceed as normal... :)

> 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.

Do you need to "remember" anything that the user enters in the form that's
specific to that user? That's all cookies are... a variable that you store
on the user's machine. If you don't already have a reason for them, you
probably don't need them.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux