Main Menu

Display All User Posts by Page

Started by Yonkey, April 20, 2004, 02:33:39 PM

Previous topic - Next topic

Storm

I hate to interude on the conversation, but you should also see what you can do about making the "Display all posts" function work for high post counts... maybe divide the display to a few pages?  ???
"Never argue with idiots. They'll drag you down to their level and beat you with experience."

Yonkey

Ugh, that would be way more complicated.  I'd have to see how the next and prev buttons would work.  Each would perform a SQL query, but deciding which rows to display... I'd have to figure out how to give each result a temporary unique autoincreasing number (which I don't know to do ;P).
"A wish changes nothing. A decision changes everything."

B'rrr

#2
the query doesn't take that long does it?? i mean wouldn't be the display of the result be the bottleneck instead of getting a few 1000 records? (not sure though)

in that case you could use the same query (or perhaps a bit adjusted) and according to the page display only those posts that belong there (page 1 = last 250 posts, page 2 = 250 posts before and so on(just a suggestion)) ...you just have to scroll through the recordset to get the right starting post...

hmm... but it isn't a nice solution though ; \ ...but then again i don't know how de database looks like ; )

EDIT: hope it makes sense... else nvm ; )
~Mary Jane supporter~
~Legend~

Yonkey

Quote from: B'rrr on April 20, 2004, 03:57:25 PM
...you just have to scroll through the recordset to get the right starting post...
That's the part I'm not sure how to do.  XD  Is there a simple way of showing rows 250-500 from a select query?  ???
"A wish changes nothing. A decision changes everything."

B'rrr

#4
hahaha well there is like (don't mind the syntax cuz i don't use any now, it is more wannabe code ; )

'loop to get the right starting record (query is orderd by mssgnumber i guess) where the pagenumber is the page you clicked on (so you could use something else) at page 3 you would loop thrrough the fist 500 posts so the next one would be 501 or something like that (at page 1 you won't loop at all
for i = 0 to (250 * (pagenumber - 1))
  recordset.movenext
next i


'now the recordset is at the right position for the displayed thread so only have to show it

for i = 0 to 250
   'show results
   recordset.movenext
   exit loop if recordset.eof
next i



autsj!! my teachers are kicking my ass for posting such a solution!!

hahaha... i don't know php that well, so i don't know what the exact functions of a recordset are, perhaps it allows to instantly jump to a number, but if it is a simple iterating recordset my solution will work i guess

*runs away in shame* ; )

EDIT: lol, if i would program this in my application i would never get a good grade ; )
~Mary Jane supporter~
~Legend~

Yonkey

#5
lol, ok I actually knew how to do that part. ;P  It was the recordset itself that I wasn't sure how to get in php, but I would have probably figured it out.

But guess what?  I just found the answer to the question I asked before you posted that:

SELECT *
FROM :suffer:
WHERE `posterName` = 'Yonkey' AND <whatever else search criteria> LIMIT x , 250

x is the starting row num.  So: 0, 250, 500, etc.

prev: x-=250, if x>250
next: x+=250, if x<(250-total)

Anyway, this still involves me making something from scratch rather than the wildcard bug that involves just one if statement.  XD

So, thanks for the suggestion Storm and well, the stuff from your first comment, Brrr!  ;D
"A wish changes nothing. A decision changes everything."

B'rrr

#6
your welcome... i guess  :S ; ) ...lol, I can't beleave I forgot the LIMIT part of SQL.... whaaa I'm going senile!! ; )

I'm glad you got your solution ; )

EDIT: btw i love your tablename  :suffer: ; )
~Mary Jane supporter~
~Legend~