in reply to Re: Counting fields from database (updated)
in thread Counting fields from database
This is the query of the database:
This follows:Select * from messages where (username='$username' or toname='$usernam +e') and message!='' order by dateadded desc, ID desc
I try to only print 10 records per page. It works perfectly for the first page, but when I come back to print the second page it duplicates some threadIDs because they are not yet in the $threadIDlist var. The second page is called with this query_string:$titlesperpage = 10; $currentpage = 1; $startcount = ($currentpage - 1) * $titlesperpage + 1; $stopcount = $currentpage * $titlesperpage; $current_count = 0; $threadcount=0; $threadIDlist = ""; while ($pointer3 = $sth3->fetchrow_hashref){ $current_count++; $threadID = $pointer3->{'threadID'}; $threads{$pointer3->{'threadID'}}++; if ($threadIDlist !~ /$threadID/) { $threadIDlist=$threadID . "," . $threadIDlist; $current_count--; $threadcount++; } }
?currentpage=2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Counting fields from database
by haukex (Archbishop) on Oct 03, 2020 at 07:29 UTC | |
by htmanning (Friar) on Oct 03, 2020 at 21:34 UTC |