|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Need to put query results into columns...
...and limit how many results go onto each page, with a "Next" link. I expect to have a few hundred entries in a table and don't want them all to be in one loooong column. Of course need to use a table here.
I'm a relative newbie to this kind of thing so bear with me. Here's what I have to pull off the info... ----------------- ...(connection stuff)... $query = "SELECT id,firstname,lastname from $userstable ORDER BY lastname, firstname ASC"; $result = MYSQL_QUERY($query); /* How many of these users are there? */ $number = MYSQL_NUMROWS($result); /* Print these results to the screen in a nice format */ $i = 0; IF ($number == 0) : PRINT "<CENTER><P>This player's information is not available at this time.</CENTER>"; ELSEIF ($number > 0) : PRINT ""; WHILE ($i < $number): $id = mysql_result($result,$i,"id"); $firstname = mysql_result($result,$i,"firstname"); $lastname = mysql_result($result,$i,"lastname"); PRINT " <a href='player.php?id=$id'>$lastname, $firstname</a><br> "; $i++; ENDWHILE; PRINT "<BR>"; ENDIF; ?> ------------------------------- It of course shows as... Jones, Joe Smith, John Peterson, Peter (etc., etc.) Would like maybe 20 results to be in 3 table columns, with a "Next 60" link at the end. Any help would be appreciated. |
|
#2
|
||||
|
||||
|
This seems to be more of a programming question than a mysql question.
|
|
#3
|
|||
|
|||
|
I'd do an igrep/Google on 'php pagination' (or something similar) and see what you get -- there are quite a few tuturials around on the subject. Aside from some LIMIT tweaking you'll need to do on each page, this is pretty much entirely a scripting issue.
__________________
"A pawn is the most important piece on the chessboard -- to a pawn" |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Need to put query results into columns... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|