Exisiting record form

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
purinkle
Forum Newbie
Posts: 12
Joined: Fri Jul 13, 2007 6:54 am

Exisiting record form

Post by purinkle »

I am designing an application that allows me to monitor music charts

At some point I need to input the individual charts

I am going to use a form to input the artist and track for it's respective position but I was wondering what the best way was to find entries that are already in the database.

Say there are already three Beastie Boys tracks in the database, I want to be able to select the artist 'Beastie Boys' instead of creating a new record in the database

Am I best off just using a SELECT box and preloading the artists into it or using some sort of search page that uses JavaScript to fill in the form?

Do you have any better ideas?

Thanks
Rob
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

The most important thing here is that your database is setup correctly. Before you get too far into this application, I suggest you post your database structure in the database forum along with a description of what your application is supposed to do. It might be fine, but it can't hurt to be sure. Fixing an application with a bad database design is very difficult to do later after the data is already entered.

For a specific answer to your question: You want to use have a select field with a list of the artists, and/or a search field that searches artists for the text you type and returns the closest matches. If you have thousands of artists then a search will be the way to go, if you have in the low hundreds, then a select is doable.

Another option is to have a search field that uses ajax to guess what you are trying to type in and autocomplete it.

To get the artists, you want to have a separate table of artists in your database. If you are adding an album or a song, and the artist doesn't exist, then you add the artist once. You may want to have a separate table for albums too. So ultimately you could look up a single album and find every song that was at one point listed in your charts.
Post Reply