CGI mysql problem

Discussion in 'Perl Misc' started by mmccaws2, May 30, 2007.

  1. mmccaws2

    mmccaws2 Guest

    Where to begin trouble shooting this?

    The problem is that I have 17 entries in mysql database and when I run
    my sub routine it only returns the entries that are not in the first
    two rows. I tried to update the first row, without result. And I re-
    entered the first two rows to rows 18 and 19 and then they would be
    entered in the feeds array.

    I'm running mysql ver mysql-5.0.37-osx10.4-i686
    apache 2.2;
    Mac osx tiger

    I check the scalar on the returned array and it always is two less
    than what the db shows.

    Thanks
    mike


    sub get_all_feeds {
    my $self = shift;
    my @args = @_;


    my $allfeed_sql = qq{
    SELECT title, url, xml, date, feed_id
    FROM rss_feeds
    };
    my $dbh = $self->{dbh};

    my $sth = $dbh->prepare($allfeed_sql) or die "Couldn't prepare:
    " . $dbh->errstr;
    $sth->execute or die "Couldn't execute: " . $sth->errstr;
    my @tablefeeds = $sth->fetchrow_array;
    # is there already a row with this username?
    if (!$sth->fetchrow_array) {
    return 0;
    }

    my @feeds;
    while (my $row = $sth->fetchrow_hashref) {
    my $feed =
    Feeds::Feed->new_feed(title => $row->{title},
    url => $row->{url},
    xml => $row->{xml},
    date => $row->{date},
    feed_id => $row->{feed_id});

    push (@feeds, $feed);
    }
    return @feeds;
    }
     
    mmccaws2, May 30, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JL
    Replies:
    0
    Views:
    1,149
  2. Ravi
    Replies:
    6
    Views:
    1,412
    Suchandra Thapa
    Jul 21, 2003
  3. Replies:
    2
    Views:
    6,199
  4. Luigi Ma
    Replies:
    0
    Views:
    147
    Luigi Ma
    Nov 21, 2007
  5. BestFriend
    Replies:
    2
    Views:
    799
Loading...

Share This Page