CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
how to use information from one DB table to hash for another DB table?

 



starburst
New User

Apr 13, 2010, 12:24 PM

Post #1 of 1 (517 views)
how to use information from one DB table to hash for another DB table? Can't Post

I have two database tables, one with two columns (a user and an id) and another with several columns. The only data these two different database tables have in common is the 'id' column... I am stumped at how to store the values for the id from the first table to a unique user variable (because one user could have multiple ids).

here is what I have started:

Code
     #Search the database if search was pressed 
if ( defined $form{cmd} && $form{cmd} eq "Search" ) {
$sqlcmd = "SELECT * from `$Database`.`$AccessTable` WHERE ";
$pattern = SafeStr($form{SearchQuery});
}

foreach $member (@tblentries) {
$mname = $member->{"member"}; #name (this case either id or user)
$mtype = $member->{"type"}; #variable type (either string or int)
$val = $member->{"val"); #actual value

....


If I could create some hash like %user, and then like this:

Code
 push @{$user{$pattern}, $ID}


push an ID value into an array of IDs for a specific user it would be ideal...I just don't know how to start it.

PLEASE help me :)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives