Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am writing a search engine with MS Access databse. the results of fetch querry are.. HASH(0ib2b69c) & so on .......some values sying HASH(.....)...Can someone tell me whts going wrong

Replies are listed 'Best First'.
Re: Perl-odbc
by Big K (Monk) on Jul 18, 2001 at 20:56 UTC
    Anonymous Monk, I have put together a small search engine using ODBC, but I didn't use a hash to store my results. I embeded & called my SELECT, generating all the html within a while loop. Here is a stripped down version of what I used.
    use DBI; # Connect to the database my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=database1.mdb'; my $dbh = DBI->connect("dbi:ODBC:$DSN") || die "Couldn't open database +: $DBI::errstr;"; # Build a query my $SQL1 = $dbh->prepare(<<End_SQL) || die "Couldnt prepare statement: + $DBI::errstr;"; select NAME_FIELD, TITLE_FIELD, EMAIL_FIELD FROM TBL_PEOPLE WHERE (TIT +LE LIKE 'monk') ORDER BY NAME End_SQL # Execute the query $SQL1->execute() || die "Couldn't execute statement: $DBI::errstr; sto +pped"; while ( my ($resultField1, $resultField2, $resultField3) = $SQL1->fetc +hrow_array() ) { # perform any formatting/storage/etc with each record } # Disconnect from the database $dbh->disconnect();
    The fields which stored the information from $SQL1->fetchrow_array() must coincide both in the number and order of the fields mentioned at the start of the SELECT statement.

    - Big K
Re: Perl-odbc
by PsychoSpunk (Hermit) on Jul 17, 2001 at 22:06 UTC
    This sounds like you are calling $rs = $sth->fetchrow_hashref() in which case you get at your data by saying $rs->{table_name}

    ALL HAIL BRAK!!!

Re: Perl-odbc
by myocom (Deacon) on Jul 17, 2001 at 22:04 UTC

    Please post the code that is generating this (and don't forget to enclose your code in <code> tags!), so we can help pinpoint where the problem lies.

    Having said that, it appears that whatever you're using to get information from your DB is returning a hash reference. You need to dereference it to get at the information. Without code, though, I can't be more specific.