in reply to Re: Re: DBI Select results confussion
in thread DBI Select results confussion

When I do bind (same code as in my original posting) but without the "fetchrow_array" line it does not output any data? i.e it only outputs data if I do the fetchrow_array command.

O.K., I think I see where the misunderstanding is. You're trying to arrange to have the result of the query show up in a variable. There are two ways to do that: you can do the appropriate binding to cause the result of a fetch to get stuffed into a variable, or you can fetch a row (either as an array or as a hash) and extract the value manually. You're trying to do the former; my snippet does the latter.

In both cases, unless a row is fetched, there's no value there to get. Hence you need to force a fetch.

I avoid using bind_column() et al. because I find the resulting code is harder to follow. Readers can easily follow code that manually fetches a row and extracts values, but using column binding forces readers to remember that there's a magic wormhole in that region of space that causes values to automagically appear elsewhere.

Replies are listed 'Best First'.
Re: Re: Re: Re: DBI Select results confussion
by heezy (Monk) on Nov 11, 2002 at 16:04 UTC

    Thanks for bearing with me whilst I explained my posting! And thanks for replying and making it clear!

    M