Anyone use mySQL?

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81
Trying to learn mySQL and PHP, and I have a quick question. i'm trying to make a database that will
keep track of my mp3s. I am going to save the following infomation.

Title, Artist, Genre, and Length

I will use VARCHAR(20) for all the variables except for Genre. I would like to use a drop down list on my
webpage to list the corresponding genre (Rap, R&B, Country, Alternative, etc...). How would I go about
defining this? Would I use ENUM or set?
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
just use text or varchar

recomend you use phpmyadmin for all your mysql building.
 

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81
I thought it over, and I just realized text or varchar will work. what exactly is ENUM and SET for?
I have to get me a mySQL book soon!
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
not a clue, I´v just used varchar, text and various versions of intager, still havent found use in the rest for what I´m doing
 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0
ENUM is Enumerated
Set is Set


basically a list of stuff you can choose from.

you could say enum the names of GPU creators like this {Nvidia, ATI, Cirrus Logic, Oak Technologies, Trident, Joe Momma}



or you see the navigation box up in the right corner, it has a enum of forums avaiable on AT.
 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136


<< I thought it over, and I just realized text or varchar will work. what exactly is ENUM and SET for?
I have to get me a mySQL book soon!
>>


ENUM and SET is essentially the same. Except for the fact that you may have an empty set and the maximum number of allowed members in a set is 64. ENUM, I believe, is limited to 65535 elements.
 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136


<< ASP/MS SQL owns PHP/mySQL any day of the week. >>


True.. for eCommerce development. But ASP/MSSQL will own you when you're on a budget. mySQL is FREE!

 

GagHalfrunt

Lifer
Apr 19, 2001
25,284
1,997
126


<<
ENUM and SET is essentially the same. Except for the fact that you may have an empty set and the maximum number of allowed members in a set is 64. ENUM, I believe, is limited to 65535 elements.
>>



Yes on the allowed members and yes that SET can be NULL, but ENUM can not be. They are essentially the same except for one important distinction. ENUM can only have one value and in fact must have one value. It'll default to the first option if otherwise undefined. SET can have several values or none at all.

For this purpose, both ENUM and SET would work for the genre column. You can give a list of possible genres and pick one from the list. However, I'd go with SET in that it would allow multiple genres to be listed for a single entry. That would allow you to pick several for songs that might straddle the line between say rock and country or between metal and alternative, etc. But since this is a personal project and you're not going to be worrying about server performance, VARCHAR would work well enough too.

That said, while this is an entry level PHP/MySQL problem and can be easily coded, why bother? There are a lot of programs available for keeping track of mp3 collections that'll do exactly what you're looking for without the work of doing it yourself.
 

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81


<< That said, while this is an entry level PHP/MySQL problem and can be easily coded, why bother? There are a lot of programs available for keeping track of mp3 collections that'll do exactly what you're looking for without the work of doing it yourself. >>



The point of this project is to learn the syntax. I know there are existing codes I could use, but I will not be using this project once I complete it. I just want to be able to say "Hey, I know how to do PHP, now let's do some advance stuff" once I'm done with this.

I went ahead and used VARCHAR for the genre.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
heh, there's a perl module that will read MP3 tag info. recursively search a directory for mp3s, and you found everything you need, up to the minute.