$sql = "SELECT book_id, title FROM booklist_table WHERE (expected_publcn_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; #### $booklist_1{$book_id} = "ok";