Jump to content

[SOLVED] Only 10


paulman888888

Recommended Posts

hi,

I have a little problem.

Can you help me show only 10 scores please?

 

<?php
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM example ORDER BY score DESC") 
or die('O no. Theres an error#');  

echo "";
echo "";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo ""; 
echo $row['score'];
echo "#"; 

} echo "#Completed";
?>

I know it shows a # but i want that their because my game interpates it as a newline.

 

Thankyou

Paul

Link to comment
https://forums.phpfreaks.com/topic/107966-solved-only-10/
Share on other sites

if u want top 10 then u use jk11uk reply.

 

if u want to put pull any then they u must set the start offset instead of 0

 

//this will pull the data from 1 to 10

$result = mysql_query("SELECT * FROM example ORDER BY score DESC LIMIT 0, 10") or die('O no. Theres an error#');

 

// this will pull the data from 11 to 10

$result = mysql_query("SELECT * FROM example ORDER BY score DESC LIMIT 10, 10") or die('O no. Theres an error#');

 

 

Link to comment
https://forums.phpfreaks.com/topic/107966-solved-only-10/#findComment-553378
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.