in reply to
Re: Inserting Hash Information Into MySQL
in thread Inserting Hash Information Into MySQL
I am using strict. The hash uses the values in @id as the key, which is why I used $id.
My apologies - the code to enter into MySQL is:
my $insert_query = "INSERT INTO test(id, stats) VALUES (?, ?);";
$sth = $dbh->prepare($insert_query);
while(($key, $value) = each(%hash)){
$sth->execute($key, $value);
}
It inserts the ID without a problem. The only issue is that arrays can't be stored in MySQL, but I don't know how to get the information out of the array to store it otherwise.