Web Hosting Talk







View Full Version : another mysql question


matt2kjones
11-30-2002, 01:46 PM
hi i making a forum and have got a problem with something

This is what happens

when a topic is made, a post is also made. Now, the topic_id in the forum_topics table has got an auto_increment number

so that goes up on its own

and so has the post_id of the post in the forum_posts table

now i have a problem

when a user creates a topic, the topic is given a topic_id, and a post is also made, the post is given an automatic post_id

now here is the problem

to tell where the post belongs i have to store the topic_id in the table where the post is stored

but if two people create topics at the same time then the post may go to the wrong topic, as the wrong topic_id may go into the forum_posts table

how could i get around this???

any ideas?

thanx

jtrovato
11-30-2002, 11:04 PM
As in the other posting I wrote to you, create an Id in the posting from the system clock. Make this field unique and use this field to reference your IDs after you have inserted them in the database