SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old June 22nd, 2005, 09:14 PM
pointman pointman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 1 pointman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 12 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old June 23rd, 2005, 07:56 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
This seems to be more of a programming question than a mysql question.

Reply With Quote
  #3  
Old June 23rd, 2005, 11:00 AM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
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"


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Need to put query results into columns...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway