Ok, I've read many threads and I'm still stumped. I basically want to display a "many" record from within the "one". In my case a user should be able to view details of a related agent. Both cfg's have UserID in the same position and I've followed the mod text, the user_html.pl code is as follows:-
$in{'UserID'} = $rec{'UserID'};
$in{'sb'} = 6;
$in{'so'} = 'descend';
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print "<table>";
for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=agency&uid=$db_uid&AgentID=$rec2{'AgentID'}&view_records=1">$rec2{'Agent name'}</a><BR>|;
</td></tr>
}
print "</table>";
}
&switch_to_user;
}I get the dreaded Internal Server Error using the above, if it's commented out then the database works ok.
Any ideas? I don't need to display the one(users) from the many(agency). So agency_html.pl is unchanged.
Code from db.cgi sub get_record :-
#-----------------------------------------------------
@db_cols = qw(UserID AgentID etc. fields');
$db_file_name = $db_script_path . "/agency.db";
}
sub switch_to_user {
#-----------------------------------------------------
@db_cols = qw(UserID 'First name' etc. all fields);
$db_file_name = $db_script_path . "/users.db";
$db_key_pos = 0;
}
Code:
&switch_to_agency; $in{'UserID'} = $rec{'UserID'};
$in{'sb'} = 6;
$in{'so'} = 'descend';
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print "<table>";
for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=agency&uid=$db_uid&AgentID=$rec2{'AgentID'}&view_records=1">$rec2{'Agent name'}</a><BR>|;
</td></tr>
}
print "</table>";
}
&switch_to_user;
}
Any ideas? I don't need to display the one(users) from the many(agency). So agency_html.pl is unchanged.
Code from db.cgi sub get_record :-
Code:
sub switch_to_agency { #-----------------------------------------------------
@db_cols = qw(UserID AgentID etc. fields');
$db_file_name = $db_script_path . "/agency.db";
}
sub switch_to_user {
#-----------------------------------------------------
@db_cols = qw(UserID 'First name' etc. all fields);
$db_file_name = $db_script_path . "/users.db";
$db_key_pos = 0;
}