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

AW: [PBML] Arrayref dereferencing

Expand Messages
  • Lange Gunter, CH
    Hi consider NULL values in your query results. gl ... Von: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] Im Auftrag von Jonathan Mangin
    Message 1 of 1 , May 2, 2006
    • 0 Attachment
      Hi

      consider NULL values in your query results.

      gl

      -----Urspr√ľngliche Nachricht-----
      Von: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] Im
      Auftrag von Jonathan Mangin
      Gesendet: Montag, 1. Mai 2006 17:14
      An: perl-beginner@yahoogroups.com
      Betreff: [PBML] Arrayref dereferencing


      Hi,

      my $sql = "select id, item, units
      from meals
      where uid = ?
      and date = ?
      and time = ?
      order by item";
      my $sth = $dbh->prepare($sql);
      $sth->execute($uid, $date, $time) || die $sth->errstr();

      my @meal = ();
      while (my @row = $sth->fetchrow_array) {
      push @meal, [@row];
      }

      I've moved this processing from TT where all worked.
      perlreftut (pgs. 5-6) seems to say I can do this but keep getting "Use of
      uninitialized value..."

      foreach my $item (@menu) {
      if ($item eq $meal[0][1]) { # Phhttt!
      $html .= "<option selected>$item";
      } else {
      $html .= "<option>$item";
      }
      }

      So I'm misunderstanding something. Can someone point out
      my error(s)? TIA.

      --Jon



      Unsubscribing info is here:
      http://help.yahoo.com/help/us/groups/groups-32.html
      Yahoo! Groups Links
    Your message has been successfully submitted and would be delivered to recipients shortly.