Re: Mysql Rows

From: Date: Mon, 06 Mar 2006 17:18:05 +0000
Subject: Re: Mysql Rows
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-231533@lists.php.net to get a copy of this message
tedd wrote:
Well it seems you output it via PHP so count it extern in PHP. And changing ID values is a "no-go!" You will never have any relation possibilities if you alter the ID fields. In short. You mess everthing up with it. There are count functions in MySQL that gives you the counted rows or output it counted. You can look at the manuals in mysql.com Good luck
    Barry
Barry: I realize that relational dB's are out if one does this -- and -- I fully understand why. That's the reason when I started this thread I made it clear that I was NOT talking about a relational dB but rather a simple flat file. What I find interesting in all of this exchange -- however -- is that everyone agree's renumbering the "id" of a dB is something you don't do, but no one can come up with a concrete (other than relational) reason why.
it's a unique identifier in time and space. changing it means potentially losing referential information (that may exist on seperate systems and/or outside of the DB). if 123 refers to product X today you should be able to rely on refering to product X next week. the the product 123 refers to changes over time the id is at the very least alot less value as an identifier (because identifier are used to refer to specific things and/or related 2 or more entities - that is only of value when ids are immutable) one of the few reasons you would want to renumber is because,as is the case here I believe, one would like to use the id values for something other than what they were designed for - i.e. using them as optential wincodes in a sweepstake type wotsit.... [primary]keyfields are meant to uniquely identify an entity (row) and nothing else.
But your suggestion to look-up the MySQL count function, is a good one, thank you. tedd


« previous php.general (#231533) next »