Loading ...
Sorry, an error occurred while loading the content.

Can someone explain this error message?

Expand Messages
  • essential quint
    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 1 of 3 , Mar 7, 2007
    • 0 Attachment
      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.blablahblah.com/x.pl?$element->{id}">$element->{title}
      <i>by</i> $element->{name} <i>from</i> $element->{location}.</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
    • Spectroman
      hello try fetchrow instead $fetchrow bbye ... href= http://www.blablahblah.com/x.pl?$element- {id} $element- {title} ...
      Message 2 of 3 , Mar 7, 2007
      • 0 Attachment
        hello

        try fetchrow instead $fetchrow

        bbye

        --- essential quint <quintessential1@...> 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.blablahblah.com/x.pl?$element->{id}">$element->{title}
        > <i>by</i> $element->{name} <i>from</i>
        > $element->{location}.</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: brclimber@...
        Fone: +55 11 2157 0452
        Mobi: +55 11 8210 3501
        Also: jchegedus@...
        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.com/collections/265
      • Spectroman
        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,
        Message 3 of 3 , Mar 7, 2007
        • 0 Attachment
          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 <quintessential1@...> 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.blablahblah.com/x.pl?$element->{id}">$element->{title}
          > <i>by</i> $element->{name} <i>from</i>
          > $element->{location}.</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: brclimber@...
          Fone: +55 11 2157 0452
          Mobi: +55 11 8210 3501
          Also: jchegedus@...
          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
        Your message has been successfully submitted and would be delivered to recipients shortly.