in reply to Re: my @Array = $sth->fetchrow_array;
in thread my @Array = $sth->fetchrow_array;

I don't get any error messages. It just does not print the @Geo_areas after it should be full with the content of the select statement. But I know that this bit of code is passed in the process because I have got it to print something else before the code that is shown here is executed (or not).
  • Comment on Re^2: my @Array = $sth->fetchrow_array;

Replies are listed 'Best First'.
Re^3: my @Array = $sth->fetchrow_array;
by McDarren (Abbot) on Jan 10, 2006 at 13:25 UTC
    It just does not print the @Geo_areas after it should be full with the content of the select statement.

    <not_entirely_tongue_in_cheek> Of course not, as there is no print statement in the code you showed us :p </not_entirely_tongue_in_cheek>

    My guess is that your $Special_data_retrieval variable isn't correctly formed, and so your query is returning zero rows. Try adding a print "$Select_areas\n"; before the query is executed, and then test it manually.

    Also, be aware that selectrow_array fetchrow_array will only give you a single row of data. So if you are expecting multiple rows then it would generally be contained within a while loop. Yes, I know you mentioned a while loop in your original post, but you indicated that the whole code snippet is within a while loop. And that isn't what I mean. What you probably need is something like this:

    while (my @row = $sth_Geo->fetchrow_array) { print "@row\n"; # Or whatever }

    If you want to grab the whole lot in one go, then you probably want to use selectall_arrayref fetchall_arrayref

    Cheers,
    Darren :)

Re^3: my @Array = $sth->fetchrow_array;
by blazar (Canon) on Jan 10, 2006 at 14:02 UTC
    To add to McDarren's excellent reply, in case of doubt why don't you just
    print 0+@Geo_areas;
    to verify it's not empty?