Gossamer Forum
Home : Products : DBMan : Customization :

Pulling data form 1 db to another.

Quote Reply
Pulling data form 1 db to another.
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);
}
Subject Author Views Date
Thread Pulling data form 1 db to another. knue 19838 Oct 1, 2015, 7:20 AM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19580 Oct 2, 2015, 8:07 AM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19582 Oct 2, 2015, 8:31 AM
Thread Re: [knue] Pulling data form 1 db to another.
knue 19534 Oct 4, 2015, 4:15 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19487 Oct 5, 2015, 8:07 AM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19486 Oct 5, 2015, 8:04 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19452 Oct 6, 2015, 3:00 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19355 Oct 12, 2015, 11:51 AM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19378 Oct 12, 2015, 1:15 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19295 Oct 14, 2015, 5:53 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19265 Oct 15, 2015, 1:24 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19203 Oct 16, 2015, 9:12 PM
Thread Re: [knue] Pulling data form 1 db to another.
knue 19230 Oct 17, 2015, 6:47 AM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19252 Oct 17, 2015, 6:57 AM
Post Re: [delicia] Pulling data form 1 db to another.
knue 19193 Oct 17, 2015, 7:37 AM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19156 Oct 29, 2015, 12:35 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19050 Oct 29, 2015, 2:36 PM
Thread Re: [delicia] Pulling data form 1 db to another.
delicia 19051 Oct 29, 2015, 2:41 PM
Thread Re: [delicia] Pulling data form 1 db to another.
delicia 19050 Oct 29, 2015, 2:52 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 19058 Oct 29, 2015, 5:30 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 19019 Oct 29, 2015, 5:38 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 18781 Dec 16, 2015, 9:10 AM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 18786 Dec 16, 2015, 5:50 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 18802 Dec 18, 2015, 5:06 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 18745 Dec 19, 2015, 6:25 AM
Post Re: [delicia] Pulling data form 1 db to another.
knue 13134 Dec 19, 2015, 7:08 AM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 13159 Dec 19, 2015, 7:58 AM
Thread Re: [knue] Pulling data form 1 db to another.
Andy 13151 Dec 19, 2015, 8:03 AM
Thread Re: [Andy] Pulling data form 1 db to another.
knue 13147 Dec 19, 2015, 8:11 AM
Thread Re: [knue] Pulling data form 1 db to another.
Andy 13270 Dec 19, 2015, 8:14 AM
Thread Re: [Andy] Pulling data form 1 db to another.
delicia 13145 Dec 19, 2015, 1:35 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 13117 Dec 21, 2015, 9:26 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 13158 Dec 22, 2015, 6:24 AM
Post Re: [delicia] Pulling data form 1 db to another.
knue 13112 Dec 22, 2015, 7:03 AM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 13137 Dec 22, 2015, 12:32 PM
Post Post deleted by delicia
delicia 13111 Dec 22, 2015, 1:20 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 13261 Dec 22, 2015, 1:25 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 13135 Dec 22, 2015, 1:34 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 13107 Dec 22, 2015, 1:40 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 13124 Dec 22, 2015, 1:46 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 13114 Dec 22, 2015, 1:51 PM
Thread Re: [delicia] Pulling data form 1 db to another.
knue 13119 Dec 22, 2015, 2:05 PM
Thread Re: [knue] Pulling data form 1 db to another.
delicia 13146 Dec 22, 2015, 2:35 PM
Post Re: [delicia] Pulling data form 1 db to another.
knue 13077 Dec 22, 2015, 9:37 PM
Post Re: [delicia] Pulling data form 1 db to another.
knue 13102 Dec 22, 2015, 1:40 PM