in reply to adding to a hash
Since I call this with %variables = get_page_content("name"); that would replace the whole hash, right? OR would it just append the new variables to this list? They will always be unique, as the column `name` has to be unique, or it will error out, when adding new records to the db.sub get_page_content { my $type = shift; my $dbh = DB_File::connect(); $sth = $dbh->prepare (qq{ SELECT `name`,`value` FROM `page_variabl +es` WHERE `type` = ? }); $sth->execute($type); my %temp_vars; # WILL THIS KILL THE REST OF THE VALUES? while(my ($db_name,$db_content) = $sth->fetchrow_array()) { $temp_vars{$db_name} = $db_content; } $sth->finish(); return(%temp_vars); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: adding to a hash
by Fastolfe (Vicar) on May 13, 2003 at 23:49 UTC |