Forum Moderators: coopster & phranque

Message Too Old, No Replies

fetchrow failed

problem

         

hcampins

4:48 pm on Feb 13, 2007 (gmt 0)

10+ Year Member



hello!

first of all, i apologize for my english, is quite bad.

i m starting with perl, and i have to solve a problem from a big project.

i found the error on that piece of code:

$query="SELECT distinct dia,hora_inici from horari where cf_assignatura=$assign AND login is not null order by dia,hora_inici";
$sth_m=Ibdg::consult($dbh,$query);
@dia=$sth_m->fetchrow();
print STDERR ("the day is: @dia");

when i print i get the massege:

the day is: DBD::mysql::st fetchrow failed: fetch() without execute()

thank you very mutch!

phranque

10:02 pm on Feb 13, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



greetings hcampin and welcome to WebmasterWorld!

i'm not sure what Ibdg::consult does but you might try adding the following after that line:

$sth_m->execute();

hcampins

3:20 pm on Feb 14, 2007 (gmt 0)

10+ Year Member



thanks phranque!

still not working.

sub consult{
my $dbh=shift(@_);
my $query=shift(@_);
my $sth=$dbh->prepare($query) ¦¦ IntranetLib2::Cgi_Error("PREPARE: $query");
$sth->execute ¦¦ IntranetLib2::Cgi_Error("EXECUTE: $query");
return $sth;
}

And when i try the query in mysql, it works.