Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Issue with Print

by GotToBTru (Prior)
on Feb 14, 2014 at 15:10 UTC ( [id://1074968]=note: print w/replies, xml ) Need Help??


in reply to Issue with Print

Your issue isn't with print, it's with fetchrow_hashref. The following is very suspicious:

while (@row = $db->fetch_assoc($row[0]))

You are using a row in an array as an argument to define that array. That doesn't make sense to me. I suspect that somewhere in the bowels of fetch_assoc() is a call to fetchrow_hashref that uses the parameter passed to the former as a parameter for the latter. That would explain the observed error message.

Replies are listed 'Best First'.
Re^2: Issue with Print
by Ashley Jordan (Novice) on Feb 14, 2014 at 15:29 UTC

    Hi,

    Thank you guys for your replies

    So would the correct format be fetch_assoc($row());?

    The module shows;

    877 my $row = $sth->fetchrow_hashref;
    Any ideas?
      The error is saying that $sth is undefined. I note you have $sth->execute() commented out in your script. My guess is that you should be calling $db->fetch_assoc($sth). If you can show us more of the fetch_assoc() method from modulename::DB that would help.

        Hi,

        Hope this is what you requested?

        cat DB.pm -n | grep fetch
        17 my $ref = $db->fetch_assoc($sth); 495 while ( my $ref = $self->fetch_assoc($sth) ) { 550 my $ref = $self->fetchOne('SELECT sql FROM sqlite_master + WHERE tbl_name = ?', $src_table); 661 selectOne($q) is a shortcut to prepare and execute a structu +re select, and fetch the first row 668 $self->select(@q)->fetchrow_hashref; 740 while ( my @arr = $sth->fetchrow_array() ) { 802 while ( my $ref = $self->fetch_assoc($sth) ) { 840 my $ref = $self->fetchOne($self->_count_sql($table, $whe +re)); 856 =item fetchOne 858 fetchOne($q) is a shortcut to prepare and execute a query, a +nd fetch the first row 862 sub fetchOne { 864 $self->query(@q)->fetchrow_hashref; 867 =item fetch_assoc 873 sub fetch_assoc { 877 my $row = $sth->fetchrow_hashref; 879 $self->die("fetching row failed ".$sth->err);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1074968]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-04-23 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found