I'm using the relational mod to relate the following databases:
1. bikereviews -> bike comments : users relates to both
2. trailreviews -> trail comments : users relates to both
With a great deal of help from JPDeni, the first set of db's works pretty well. So I figured that I'd just copy the bike stuff and modify them to fit with trail reviews. I added the switches to the db.cgi as well.
Here's the problem. "trail comments" are supposed to display under "trail reviews" however - they aren't. I changed the switch and cfg files according to the names of the new db's. For instance, "ReviewID" was the common field in my bike db's -- so I just changed it to "TrailID". Didn't work though.
Here's what I have for my "trail comments" cfg: (took out some of the fields to shorten the post)
trailcommentID => [0, 'numer', 5, 8, 1, '', ''],
trailcommentUserid => [6,'alpha', -2, 15, 0, '', ''],
trailcommentValidated => [7,'alpha', 0, 3, 0, 'No', 'Yes|No'],
TrailID => [8, 'numer', 5, 8, 1, '', '']
$db_key = 'trailcommentID';
Here's my trailreviews cfg. I'll only post a couple of the entries 'cuz there's 15 of 'em.
TrailID => [0, 'numer', 5, 8, 1, '', ''],
Userid => [14,'alpha', -2, 15, 0, '', ''],
Validated => [15,'alpha', 0, 3, 0, 'No', 'Yes|No']
$db_key = 'TrailID';
This is what I have in the trailreviews_html.pl at the part where its supposed to scoop the trail comments:
&switch_to_comments_trailreviews;
undef %in;
$in{'TrailID'} = $rec{'TrailID'};
$in{'trailcommentValidated'} = 'Yes';
$in{'so'} = 'descend';
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
%rec2 = &array_to_hash($_, @hits2);
I'm using %rec2 in the bikereviews db but I figured that since the trails and bikes db's aren't related, I don't need to change it to %rec4 or something. (I tried it but it didn't do anything).
So the stuff that should display, I just put something like $rec2{'trailcommentUserid'} etc.
I uploaded all of my db files to the server to clarify my problem.
Working version at:
http://visit-my-webpage.com/....cgi?db=trailreviews
Setup files at:
http://www.visit-my-webpage.com/tmp/
When I add a comment to a trailreview (db switches to the comments db), pulling the original trailreview data into the trail "comment" works okay - reversing it doesn't work.
I've been messing with it for a few days now in attempt to fix it myself but its a no go.
This "should" be my last relational db for my site. Once again, thanks for all the help!!
-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
1. bikereviews -> bike comments : users relates to both
2. trailreviews -> trail comments : users relates to both
With a great deal of help from JPDeni, the first set of db's works pretty well. So I figured that I'd just copy the bike stuff and modify them to fit with trail reviews. I added the switches to the db.cgi as well.
Here's the problem. "trail comments" are supposed to display under "trail reviews" however - they aren't. I changed the switch and cfg files according to the names of the new db's. For instance, "ReviewID" was the common field in my bike db's -- so I just changed it to "TrailID". Didn't work though.
Here's what I have for my "trail comments" cfg: (took out some of the fields to shorten the post)
trailcommentID => [0, 'numer', 5, 8, 1, '', ''],
trailcommentUserid => [6,'alpha', -2, 15, 0, '', ''],
trailcommentValidated => [7,'alpha', 0, 3, 0, 'No', 'Yes|No'],
TrailID => [8, 'numer', 5, 8, 1, '', '']
$db_key = 'trailcommentID';
Here's my trailreviews cfg. I'll only post a couple of the entries 'cuz there's 15 of 'em.
TrailID => [0, 'numer', 5, 8, 1, '', ''],
Userid => [14,'alpha', -2, 15, 0, '', ''],
Validated => [15,'alpha', 0, 3, 0, 'No', 'Yes|No']
$db_key = 'TrailID';
This is what I have in the trailreviews_html.pl at the part where its supposed to scoop the trail comments:
&switch_to_comments_trailreviews;
undef %in;
$in{'TrailID'} = $rec{'TrailID'};
$in{'trailcommentValidated'} = 'Yes';
$in{'so'} = 'descend';
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
%rec2 = &array_to_hash($_, @hits2);
I'm using %rec2 in the bikereviews db but I figured that since the trails and bikes db's aren't related, I don't need to change it to %rec4 or something. (I tried it but it didn't do anything).
So the stuff that should display, I just put something like $rec2{'trailcommentUserid'} etc.
I uploaded all of my db files to the server to clarify my problem.
Working version at:
http://visit-my-webpage.com/....cgi?db=trailreviews
Setup files at:
http://www.visit-my-webpage.com/tmp/
When I add a comment to a trailreview (db switches to the comments db), pulling the original trailreview data into the trail "comment" works okay - reversing it doesn't work.
I've been messing with it for a few days now in attempt to fix it myself but its a no go.
This "should" be my last relational db for my site. Once again, thanks for all the help!!
-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net