Now that I have the relational database working
, I'm down to what I hope is the last mile.
I apologize if I've missed this from other posts ... (I did search - honest
)
Anyway, what I need to do now is to get two different searches working from a static web page outside the database.
The problem is to get results that span both databases. Profile (the one) and Playlist (the many)
One of the searches, I was hoping would be a simple keyword search that would return results from both databases. If I have to, I can offer 2 search options for the keyword search, which I have temporarily set up to work, but it would definitely be tidier if I could figure out how to do it with one.
The other search is to be based on 2 criteria. Genre and Featured. Now Genre is one of the items that I had set up in the profile (the one) database since it would be the same no matter how many playlists a DJ is listing. But the information that needs to be returned is now set up for the playlist (the many). When I realized this, I figured that I needed to add the genre field into the playlist database as well. So far I haven't succeeded at this tactic either. Am I on the right track, and if so, any pointers?
Here's what I've tried so far ...
I added the Genre field to the db.cgi (sub switch_to_playlist)
$cols = 'DJ,PlayListID,Genre,DateAdded,Playlist,Favorite';
Then I inserted Genre to playlist.cfg
Genre' => [ 2, 'alpha', 20, 255, 1, '', ''],
Note: in profile.cfg Genre is a drop down list. Since it would have already been selected when the user registered, I don't want to offer the same option here, but to have the database automatically fill it in.
As a point of reference, this is how it looks in profile.cfg
'Genre' => [ 2, 'alpha', 0, 10, 1, 'High Seas', ''],
and then further down
%db_select_fields = (
'Genre' => 'Calm,High Seas,Hurricane,Fantasy'
);
In play_html.pl I tried
within sub html_record_form
<input type="hidden" NAME="Genre" VALUE="$rec{'Genre'}">
This is right after a similar hidden field for DJ which is the UserId field
Then in sub html_record after the following line
%rec2 = &get_record($rec{'DJ'});
I tried adding
%rec2 = &get_record($rec{'Genre'});
... This felt pretty shaky, I'm not sure which line should actually be telling it to get the info and this seemed promising. Well anyway, the end result of this was that when I tried to add a record in the playlists, I get a message which says that the field was not filled out. Actually it's hidden just as the DJ field is.
Let me know what other information I need to provide for consideration.
But now, the other part of that question ... I'll gladly wait until the Genre part is resolved, but I'm stating it here in case this suggests a different tactic entirely. There is one other field in the Playlists (multi) database that is a field that only the administrator can see. It is a checkbox field. The purpose for this field is so that I can select one playlist from each DJ to feature in a Genre search. In other words, this search form would show a drop down menu with the genres. A visitor would select one genre from the list, and when they click on the button, they would see a list with one playlist from each registered DJ in that particular genre.
Hopefully it's not as complicated as I probably just made it sound.
Thanks
Rich Newman

I apologize if I've missed this from other posts ... (I did search - honest

Anyway, what I need to do now is to get two different searches working from a static web page outside the database.
The problem is to get results that span both databases. Profile (the one) and Playlist (the many)
One of the searches, I was hoping would be a simple keyword search that would return results from both databases. If I have to, I can offer 2 search options for the keyword search, which I have temporarily set up to work, but it would definitely be tidier if I could figure out how to do it with one.
The other search is to be based on 2 criteria. Genre and Featured. Now Genre is one of the items that I had set up in the profile (the one) database since it would be the same no matter how many playlists a DJ is listing. But the information that needs to be returned is now set up for the playlist (the many). When I realized this, I figured that I needed to add the genre field into the playlist database as well. So far I haven't succeeded at this tactic either. Am I on the right track, and if so, any pointers?
Here's what I've tried so far ...
I added the Genre field to the db.cgi (sub switch_to_playlist)
$cols = 'DJ,PlayListID,Genre,DateAdded,Playlist,Favorite';
Then I inserted Genre to playlist.cfg
Genre' => [ 2, 'alpha', 20, 255, 1, '', ''],
Note: in profile.cfg Genre is a drop down list. Since it would have already been selected when the user registered, I don't want to offer the same option here, but to have the database automatically fill it in.
As a point of reference, this is how it looks in profile.cfg
'Genre' => [ 2, 'alpha', 0, 10, 1, 'High Seas', ''],
and then further down
%db_select_fields = (
'Genre' => 'Calm,High Seas,Hurricane,Fantasy'
);
In play_html.pl I tried
within sub html_record_form
<input type="hidden" NAME="Genre" VALUE="$rec{'Genre'}">
This is right after a similar hidden field for DJ which is the UserId field
Then in sub html_record after the following line
%rec2 = &get_record($rec{'DJ'});
I tried adding
%rec2 = &get_record($rec{'Genre'});
... This felt pretty shaky, I'm not sure which line should actually be telling it to get the info and this seemed promising. Well anyway, the end result of this was that when I tried to add a record in the playlists, I get a message which says that the field was not filled out. Actually it's hidden just as the DJ field is.
Let me know what other information I need to provide for consideration.
But now, the other part of that question ... I'll gladly wait until the Genre part is resolved, but I'm stating it here in case this suggests a different tactic entirely. There is one other field in the Playlists (multi) database that is a field that only the administrator can see. It is a checkbox field. The purpose for this field is so that I can select one playlist from each DJ to feature in a Genre search. In other words, this search form would show a drop down menu with the genres. A visitor would select one genre from the list, and when they click on the button, they would see a list with one playlist from each registered DJ in that particular genre.
Hopefully it's not as complicated as I probably just made it sound.
Thanks
Rich Newman