Stenyj has asked for the wisdom of the Perl Monks concerning the following question:
# NOTE: the value of the following array is pulled # from a field in a table (to determine what the user # has access to/is a member of. The first number is the database/subdo +main # it's located on, the second number is the ID number of the area and +coincidentally # the ID # of the folder the site is contained within, under the subdo +main. my @userCanAccess = (1:2, 1:3, 2:6, 2:9, 1:10); my $dbh = DBI->connect("DBI:mysql:dbname:localhost","username","pw"); foreach my $i (@userCanAccess) { my ($sub, $area) = (split /:/, $i); my $dbName; # dbName is the same as the name as the subdomain if ($sub == 1) { $dbName = 'db1'; } elsif ($sub == 2) { $dbName = 'db2'; } elsif ($sub == 3) { $dbName = 'db3'; } elsif ($sub == 4) { $dbName = 'db4'; }; my $statement = "SELECT folderName, accessLevel, userID, otherColu +mn FROM $dbName.areas WHERE areaID = ?"; my $sth = $dbh->prepare($statement) or die "Can't prepare $stateme +nt: $dbh->errstr\n"; $sth->execute("$i") or die "Can't execute the query: $sth->errstr" +; my @row = $sth->fetchrow_array; my $folderName = $row[0]; my $accessLevel = $row[1]; my $userID = $row[2]; my $otherColumn = $row[3]; my $rows = $sth->rows(); $sth->finish; #### Here is where I run into my question. } $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Session management problem. Multiple Sessions @ one time?
by tachyon (Chancellor) on Jul 02, 2004 at 00:12 UTC |