Re: Unique ID

From: Date: Tue, 11 Nov 2003 23:59:59 +0000
Subject: Re: Unique ID
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-169215@lists.php.net to get a copy of this message
Marek Kilimajer wrote:
Dimitri Marshall wrote:
I'm making a message board and I've decided the best way to go about the structure is to have 3 tables, two of them will be "Posts" and "Replys". Now, in order for this ti work, each post has to have a UniqueID - same with the replys. Looking at another program, I can see that one way to do this is to do it by rows (ie. count how many rows, add 1, then that is the ID). It would be unique because no two rows would be 1 for example. The problem I can see is that the database would become incredibly huge (size wise I mean). I want to delete the posts after 30 days, and if I delete the row, then that would mess up the row system. Any suggestions?
Have you heard about auto_increment? Read on: http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html
Keep reading about database design, too. You'll only need one table and a "parent-child" relationship. The initial post will have a parent of "zero" and "child" posts under it will have a parent column relating back to the original post. I may not have explained that the best way, but there are plenty of articles out there about it. Have fun. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#169215) next »