Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old March 29th, 2003, 09:26 PM
elvensage elvensage is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Topeka, Kansas, USA
Posts: 1 elvensage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to elvensage Send a message via AIM to elvensage
Only showing limited amount of data.

Alright, what I have is a database that contains a bunch of items for a videogame I play. It displays the Type, Item Name, and some sale prices that you wouldn't understand. What I want to do is only display things depending on their "type." So I can have a seperate page that displays Weapons, Armor, etc.

Here is the code I'm using, I'm not sure how I need to modify it:

php Code:
Original - php Code
  1. <?php
  2. $db = blah blah
  3. mysql_select_db("yabbse2",$db);
  4. $result = mysql_query("SELECT * FROM pe_items SHOW type",$db);
  5. echo "<TABLE>";
  6. echo "<TR><TD><B>type</B><TD><B>Item<TD><B>Trade Terminal Value</B><TD><B>Our Price</B></TR>";
  7. while($myrow = mysql_fetch_array($result))
  8. {
  9. echo "<TR><TD>";
  10. echo $myrow["type"];
  11. echo "<TD>";
  12. echo $myrow["name"];
  13. echo "<TD>";
  14. echo $myrow["TT"]
  15. echo "<TD>";
  16. echo $myrow["sale"];
  17. }
  18. echo "</TABLE>";
  19. ?> 

Reply With Quote
  #2  
Old March 29th, 2003, 11:09 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Only showing limited amount of data.

Nevermind, I figured it out:

php Code:
Original - php Code
  1.  
  2. $t = mysql_query("SELECT type,name,TT,sale FROM pe_items WHERE type='Weapon'");
  3. $x = mysql_numrows($t);
  4. $output = "<TABLE>";
  5. for($i=0;$i<$x;$i++){
  6.      $type = mysql_result($t,$i,"type");
  7.      $name = mysql_result($t,$i,"name");
  8.      $TT = mysql_result($t,$i,"TT");
  9.      $sale = mysql_result($t,$i,"sale");
  10.      $output .= "<TR><TD>$type</TD><TD>$name</TD><TD>$TT</TD><TD>$sale</TD></TR>";
  11. }
  12. $output .= "</TABLE>";
  13. echo $output;

Reply With Quote
  #3  
Old March 30th, 2003, 12:07 AM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Send a message via Yahoo to postalcow
RE: Only showing limited amount of data.

You can also do it this way
Code:
SELECT * FROM sometable LIMIT 5; # Retrieve first 5 rows
SELECT * FROM sometable LIMIT 5,10; # Retrieve rows 6-15
SELECT * FROM sometable LIMIT 95,-1; # Retrieve rows 96-last.



Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Only showing limited amount of data.


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 | 
  
 

IBM developerWorks




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