Re: Mysql Rows

From: Date: Sat, 04 Mar 2006 06:49:20 +0000
Subject: Re: Mysql Rows
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-231439@lists.php.net to get a copy of this message
On 4/03/2006 2:49 PM, benifactor wrote:
thank you. the table does have and id feild that auto increments, however if you delete a user there will be a gap between the users between which would not be what is not acurate enough. thank you for you help. simple fix. i should have caught it. ----- Original Message ----- From: "Anthony Ettinger" <aettinger@sdsualumni.org> To: "benifactor" <snorris17@cox.net> Cc: "php" <php-general@lists.php.net> Sent: Friday, March 03, 2006 3:52 PM Subject: Re: [PHP] Mysql Rows define $1 = 0 outside your loop. i'm curious why you are relying on row-order in the database? Typically you'd have a PRIMARY KEY auto_increment for something like this.
I have to agree with Anthony - why are you using row order to determine something relating to users? I couldn't follow your brief explanation above, and the fact that you're doing it sets off some soft alarm bells about the design of your application. Why is it important that there shouldn't be any 'gaps' between users? Because you want to know how many users there are? If so, simply do a SELECT COUNT(*) on the table whenever / wherever you need to know. If you're using it for IDs for the users, it's generally a bad idea to reuse this type of information. If you have some other purpose, I'm extremely curious about what it might be. Much warmth, planetthoughtful --- "Lost in thought" http://www.planetthoughtful.org

« previous php.general (#231439) next »