Re: Mysql Rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/3/06, Murray @ PlanetThoughtful <lists@xxxxxxxxxx> wrote:
> 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@xxxxxxxxxxxxxx>
> > To: "benifactor" <snorris17@xxxxxxx>
> > Cc: "php" <php-general@xxxxxxxxxxxxx>
> > Sent: Friday, March 03, 2006 3:52 PM
> > Subject: Re:  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
>
>


What I was getting at is you get the unique id for the username (if
you allow username changes, then you want a unique key to do your
joins on from other tables).



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux