Let me start off by telling you how my system is set up.
First I have 2 db one named "dbads" and the other is "master".
There are 3 dir's, "dbads", "master" and "db". The "dbads" and "master" each have the following files
"auth.pl, db.cgi, default.cfg, default.count, default.log and html.pl". The "db" dir has, "auth(dir)
dbads.db, master.db and default.pass".
the data base is setup for events, dbads hold the last four events. When we start the 5th event the oldest one will
be moved to the master db (by the way of Archive Mod). The master db will keep events 5-10 after that they will be deleted.
I separate the db to keep them from getting to big (dbads which is the main db hold about 2400 records and the master has about 9000 records).
Now for the fun part:-)
Admin is the only one that uses the master db. We use it mainly to lookup the history of donors. but the data is incomplete
because half of the information (events 1-4) is in the dbads db. What i would like to do is pull that data and display it with
the data in the master db so we can see the full history of each donor.
I found this code which is spose to do this, but it is vag on where it go's and how to use it. I put the "sub" in my master db.cgi
and i'm pretty sure the "|; print &get_all_records_from_dbads; print qq|" go's in my master html.pl but dont know here. i also think there is something missing.
Any ideals?
Thank you'
Ed-
call another html_pl from a other html_pl
---------------------------------------------
If you want to print out some records from the database dbads while logged into another database,
this is not quite easy, but can be done:
|; print &get_all_records_from_dbads; print qq|
sub get_all_records_from_dbads {
#-------------------------------------------------------
my $output;
# switch to dbads
undef(@db_cols);
do ("dbads.cfg");
my %old_in = %in;
undef(%in);
# end of switch
# define search terms and parameters
$in{'LfdNr'} = "*"; # you can also specify sort options: $in{'sb'} = "1"; and so on.
# do the actual search
my ($status, @hits) = query("view"); # now search dbads for all records
# output results
if ($status eq "ok") {
my $numhits = @hits / @db_cols;
for (0 .. $numhits-1) {# basically the same routine as in html_view_success
my %rec = &array_to_hash($_, @hits);
$output .= qq|$rec{'Company'} and $rec{'Contact'} and $rec{'Email'}
|; # copy text from html_record for dbads
}
}# end if status ok
# switch back to the original database
undef(@db_cols);
do("$db_setup.cfg");
undef(%in);
%in = %old_in;
return ($output);
}
First I have 2 db one named "dbads" and the other is "master".
There are 3 dir's, "dbads", "master" and "db". The "dbads" and "master" each have the following files
"auth.pl, db.cgi, default.cfg, default.count, default.log and html.pl". The "db" dir has, "auth(dir)
dbads.db, master.db and default.pass".
the data base is setup for events, dbads hold the last four events. When we start the 5th event the oldest one will
be moved to the master db (by the way of Archive Mod). The master db will keep events 5-10 after that they will be deleted.
I separate the db to keep them from getting to big (dbads which is the main db hold about 2400 records and the master has about 9000 records).
Now for the fun part:-)
Admin is the only one that uses the master db. We use it mainly to lookup the history of donors. but the data is incomplete
because half of the information (events 1-4) is in the dbads db. What i would like to do is pull that data and display it with
the data in the master db so we can see the full history of each donor.
I found this code which is spose to do this, but it is vag on where it go's and how to use it. I put the "sub" in my master db.cgi
and i'm pretty sure the "|; print &get_all_records_from_dbads; print qq|" go's in my master html.pl but dont know here. i also think there is something missing.
Any ideals?
Thank you'
Ed-
call another html_pl from a other html_pl
---------------------------------------------
If you want to print out some records from the database dbads while logged into another database,
this is not quite easy, but can be done:
|; print &get_all_records_from_dbads; print qq|
sub get_all_records_from_dbads {
#-------------------------------------------------------
my $output;
# switch to dbads
undef(@db_cols);
do ("dbads.cfg");
my %old_in = %in;
undef(%in);
# end of switch
# define search terms and parameters
$in{'LfdNr'} = "*"; # you can also specify sort options: $in{'sb'} = "1"; and so on.
# do the actual search
my ($status, @hits) = query("view"); # now search dbads for all records
# output results
if ($status eq "ok") {
my $numhits = @hits / @db_cols;
for (0 .. $numhits-1) {# basically the same routine as in html_view_success
my %rec = &array_to_hash($_, @hits);
$output .= qq|$rec{'Company'} and $rec{'Contact'} and $rec{'Email'}
|; # copy text from html_record for dbads
}
}# end if status ok
# switch back to the original database
undef(@db_cols);
do("$db_setup.cfg");
undef(%in);
%in = %old_in;
return ($output);
}