CGI mysql problem

M

mmccaws2

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;
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top