in reply to retrieving the reply count of a thread using regular ol' DBI and CGI::Application
It looks like you misunderstand how the count feature works in MySQL and how the db was going to return the data. Here I used arrayref but you could also use hashref if you so desired.#get the reply count... my $sth2 = $dbh->prepare("SELECT COUNT(*) FROM h_replies WHERE thread_ +id=?"); my $do = $sth2->execute() || die "Error counting posts: $DBI::errstr\n +"; while(my $count = $sth2->fetchrow_arrayref) { push @rows_data, { count => @{$count}[0] }; } $sth2->finish(); return wantarray ? @rows_data : \@rows_data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: retrieving the reply count of a thread using regular ol' DBI and CGI::Application
by stonecolddevin (Parson) on Oct 11, 2005 at 04:37 UTC | |
by Excalibor (Pilgrim) on Oct 11, 2005 at 13:55 UTC | |
by stonecolddevin (Parson) on Oct 11, 2005 at 21:25 UTC |