in reply to Re^6: Why is my code assigning the last-retrieved value to all elements in my hash?
in thread Why is my code assigning the last-retrieved value to all elements in my hash?
makes it all work perfectly.$sql = "SELECT book_id, title FROM booklist_table WHERE (expected_publ +cn_date >= '".$start_date."' AND expected_publcn_date <= '".$end_date +."')"; $sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh->errstr) +; $sth->execute() or die("Could not execute!" . $dbh->errstr); while (($book_id, $title) = $sth->fetchrow_array()) { $booklist_1{$book_id} = $title; } $sth->finish;
Changing just one line of the above code to
makes it revert to the original incorrect behaviour.$booklist_1{$book_id} = "ok";
|
|---|