Create error for duplicate comment titles

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ninethousandfeet
Forum Contributor
Posts: 130
Joined: Tue Mar 10, 2009 4:56 pm

Create error for duplicate comment titles

Post by ninethousandfeet »

hello,

i allow users to start comment conversations with one another. when a new conversation is started, the user is required to enter a topic title.
example:
-- Topic: Hello, Nice to meet you! ... Joe, John, and Carol are all in this ongoing chat/conversation.
-- Billy decides to start a new conversation with Bobby and names the Topic: Hello, Nice to meet you!
-- Now Billy and Bobby show up in the dialogue with Joe, John, and Carol rather than just a chat between themselves.

I can't make my comment_title field unique because I use it to relate every comment that is posted in the ongoing conversations.
Does anyone know how I can simply set up a conditional IF statement to check just the insert NEW comment form so that $_POST['comment_title'] does not equal a comment_title in use?

thank you!
tech603
Forum Commoner
Posts: 84
Joined: Thu Mar 19, 2009 12:27 am

Re: Create error for duplicate comment titles

Post by tech603 »

If your going to allow duplicate names to be created in your database you need another way to identify your chat conversations. The chat should not be identified by its name but rather a unique id field. Given the assumption that your conversations or how they are viewed rather are based on there names, i would say that unique identifiers not for the name but for the topic itself would fix your problem

Hope that helps.
ninethousandfeet
Forum Contributor
Posts: 130
Joined: Tue Mar 10, 2009 4:56 pm

Re: Create error for duplicate comment titles

Post by ninethousandfeet »

i will try that out and see how it works out, i think i get what you are saying. thank you!
Post Reply