[UPHPU] Dual ID numbers

Tyler Gee geekout at gmail.com
Tue Jun 7 10:17:38 MDT 2005


Seems like you should have one table for composers and one table for
CDs, each with unique ids.  Then, in the CD table, link the composer
ID.

Maybe I don't understand what you are asking though...

-wtgee

On 6/7/05, Timothy Humphrey <timothy.humphrey at gmail.com> wrote:
> Hello all.
> 
> I need to be able to store info into a MySQL DB using auto-increment.
> Simple enough. But I need to have individual auto-increments based off a
> multiple digit ID number.
> 
> Let me give an example: I have a music collection of three composers. I
> want to personally assign an ID number to each composer (1, 2, 3). Then
> I want to enter the info for each CD (with a drop-down list to choose
> the composer #1, 2, or 3), and have a MySQL auto-increment number
> assigned for each CD. The problem is that I want to have CD 1-20 for
> Composer 1, CD 1-20 for Composer 2, and CD 1-20 for Composer 3.
> 
> Should I create 3 DB tables, one for each composer? or should I use PHP
> to assign the numbers and leave MySQL with "int" fields? or is there a
> way to use a primary and secondary field within the auto-increment
> feature of MySQL?
> 
> I would prefer to use the last option, because then I could have a
> million composers without adjusting the PHP each time. And I prefer not
> to use the second option (PHP assigned numbers) because if I have a
> hundred people entering my data (what can I say, it's a vast
> collection), then I don't run the risk of two people entering the same
> number.
> 
> TIA
> Timothy
> 
> _______________________________________________
> 
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>




More information about the UPHPU mailing list