List Info

Thread: Can someone explain this error message?




Can someone explain this error message?
country flaguser name
United States
2007-03-07 13:24:23
Greetings Folks,

I was wondering if someone could help me to understand why I
am getting an 
error message, and how I could correct it?

#### Here's the error message: ####

Software error:

Global symbol "$fetchrow_hashref" requires
explicit package name at x-it.pl 
line 236.
syntax error at x-it.pl line 236, near
"$fetchrow_hashref("
Global symbol "$element" requires explicit package
name at x-it.pl line 239.
Execution of x-it.pl aborted due to compilation errors.

#### Here's the code: ####


sub index {

# DECLARE VARIABLES
my ($dbh) = shift;
my ($sth, $stmt);

#RUN_QUERY
$stmt = $dbh->prepare("SELECT * FROM wish") or
&dbdie;
$sth = $dbh->prepare ($stmt);
$sth->execute ();

# PRINT_LOOP
while (my $element = $fetchrow_hashref())
{
  print
  <p align="center"><a 
href="http://www.blablahbl
ah.com/x.pl?$element->">$element->{tit
le}
  <i>by</i> $element->
<i>from</i>
$element->.</a><br>
}


Am not sure why the compiler is telling me I need to declare
a variable for 
$fetchrow_hashref, as I copied it straight out of the book,
so any good help 
will be much appreciated.

Thanks,

Quint

____________________________________________________________
_____
The average US Credit Score is 675. The cost to see yours:
$0 by Experian. 
http://www.freecreditreport.
com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE




Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: Can someone explain this error message?
country flaguser name
United States
2007-03-07 13:45:57
hello

try fetchrow instead $fetchrow

bbye

--- essential quint <quintessential1hotmail.com> wrote:

> Greetings Folks,
> 
> I was wondering if someone could help me to understand
why I am
> getting an 
> error message, and how I could correct it?
> 
> #### Here's the error message: ####
> 
> Software error:
> 
> Global symbol "$fetchrow_hashref" requires
explicit package name at
> x-it.pl 
> line 236.
> syntax error at x-it.pl line 236, near
"$fetchrow_hashref("
> Global symbol "$element" requires explicit
package name at x-it.pl
> line 239.
> Execution of x-it.pl aborted due to compilation
errors.
> 
> #### Here's the code: ####
> 
> 
> sub index {
> 
> # DECLARE VARIABLES
> my ($dbh) = shift;
> my ($sth, $stmt);
> 
> #RUN_QUERY
> $stmt = $dbh->prepare("SELECT * FROM
wish") or &dbdie;
> $sth = $dbh->prepare ($stmt);
> $sth->execute ();
> 
> # PRINT_LOOP
> while (my $element = $fetchrow_hashref())
> {
>   print
>   <p align="center"><a 
>
href="http://www.blablahbl
ah.com/x.pl?$element->">$element->{tit
le}
>   <i>by</i> $element->
<i>from</i>
> $element->.</a><br>
> }
> 
> 
> Am not sure why the compiler is telling me I need to
declare a
> variable for 
> $fetchrow_hashref, as I copied it straight out of the
book, so any
> good help 
> will be much appreciated.
> 
> Thanks,
> 
> Quint
> 
>
____________________________________________________________
_____
> The average US Credit Score is 675. The cost to see
yours: $0 by
> Experian. 
>
http://www.freecreditreport.
com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE

> 
> 


...Julio Cesar Hegedus Version 32.4*LC*
...Spectro is Novell Netware & Linux Specialist
+=================================================+
>>Web Sites
http://spectronet.
kicks-ass.org:88
---------------------------------------------------
>>Contact Info
ICQ: 3614823
MSN: brclimberhotmail.com
Fone: +55 11 2157 0452
Mobi: +55 11 8210 3501
Also: jchegedusgmail.com
CAP #.:
928---------------------------------------------------



 
____________________________________________________________
________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.c
om/collections/265 


Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: Can someone explain this error message?
country flaguser name
United States
2007-03-07 13:50:28
hi again,

well, my asnwer was quite uncomplete, after send it I saw
another
error, then the best way to explain this is with examples
and to be
really helpful, take a look in the following:

         row_ary  = $sth->fetchrow_array;
         $ary_ref  = $sth->fetchrow_arrayref;
         $hash_ref = $sth->fetchrow_hashref;

         $ary_ref  = $sth->fetchall_arrayref;
         $ary_ref  = $sth->fetchall_arrayref( $slice,
$max_rows );

         $hash_ref = $sth->fetchall_hashref( $key_field
);

extracted from "man DBI" -> where $sth is the
statement already
received from prepare and executed

bbye

--- essential quint <quintessential1hotmail.com> wrote:

> Greetings Folks,
> 
> I was wondering if someone could help me to understand
why I am
> getting an 
> error message, and how I could correct it?
> 
> #### Here's the error message: ####
> 
> Software error:
> 
> Global symbol "$fetchrow_hashref" requires
explicit package name at
> x-it.pl 
> line 236.
> syntax error at x-it.pl line 236, near
"$fetchrow_hashref("
> Global symbol "$element" requires explicit
package name at x-it.pl
> line 239.
> Execution of x-it.pl aborted due to compilation
errors.
> 
> #### Here's the code: ####
> 
> 
> sub index {
> 
> # DECLARE VARIABLES
> my ($dbh) = shift;
> my ($sth, $stmt);
> 
> #RUN_QUERY
> $stmt = $dbh->prepare("SELECT * FROM
wish") or &dbdie;
> $sth = $dbh->prepare ($stmt);
> $sth->execute ();
> 
> # PRINT_LOOP
> while (my $element = $fetchrow_hashref())
> {
>   print
>   <p align="center"><a 
>
href="http://www.blablahbl
ah.com/x.pl?$element->">$element->{tit
le}
>   <i>by</i> $element->
<i>from</i>
> $element->.</a><br>
> }
> 
> 
> Am not sure why the compiler is telling me I need to
declare a
> variable for 
> $fetchrow_hashref, as I copied it straight out of the
book, so any
> good help 
> will be much appreciated.
> 
> Thanks,
> 
> Quint
> 
>
____________________________________________________________
_____
> The average US Credit Score is 675. The cost to see
yours: $0 by
> Experian. 
>
http://www.freecreditreport.
com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE

> 
> 


...Julio Cesar Hegedus Version 32.4*LC*
...Spectro is Novell Netware & Linux Specialist
+=================================================+
>>Web Sites
http://spectronet.
kicks-ass.org:88
---------------------------------------------------
>>Contact Info
ICQ: 3614823
MSN: brclimberhotmail.com
Fone: +55 11 2157 0452
Mobi: +55 11 8210 3501
Also: jchegedusgmail.com
CAP #.:
928---------------------------------------------------



 
____________________________________________________________
________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://
tools.search.yahoo.com/shortcuts/#news


------------------------ Yahoo! Groups Sponsor
--------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/4It09A/fOaOAA/yQLSAA/ndFolB/TM

------------------------------------------------------------
--------~-> 

Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )