in reply to DBI - selectcol_arrayref not working

Your $query is failing and you don't have RaiseError set on the DBI handle. Store the result to another variable and check if it's undef or not; if it is, check $dbh->errstr to see what went wrong.

my $res = $dbh->selectcol_arrayref( $query ); unless( defined $res ) { die "Error executing '$query': ", $dbh->errstr, "\n"; } my $welcome = pop @{ $res };

Also of use may be using the trace method on your handle to watch exactly what's being sent back and forth to your underlying database.

Update: Heh. So . . . do you perhaps think you should check if you're getting undef back?

Replies are listed 'Best First'.
Re^2: DBI - selectcol_arrayref not working
by PaulBerry (Novice) on Dec 20, 2006 at 20:01 UTC
    Can i just say LONG LIVE THE PERL MONKS! ?
    Long, long, live the perl monks
    This was such a stupid one on my part, the tablename had switched to all lower case on migration, not sure why, but that code was EXACTLY what i needed to figure that out

    How do I make sure people get credit for the help their giving? I'm a recent perlmonker

    Paul
Re^2: DBI - selectcol_arrayref not working
by PaulBerry (Novice) on Dec 20, 2006 at 19:57 UTC
    Thanks! just read this after posting my last question, time to check that out. The thing is that the same code works fine on a different server, with the same DB definitions, but I'll plug in the die errors and see what comes from that.