Jump to content

[SOLVED] PHP/MySQL -- Only displaying a set amount of records...


cwncool

Recommended Posts

I have a script, that displays the correct information fine, all four fields from the table.  It is this

<?php
include 'connect.php'
?>
<table>
<tr>
<th>user</th>
<th>num</th>
</tr>
<?php
$con = mysql_query("SELECT * FROM users ORDER BY num DESC");
while($arr = mysql_fetch_array($con)) {
?>
<tr>
<td><? echo $arr['user']; ?></td>
<td><? echo $arr['num']; ?></td>
</tr>
<?php 
} 
?>
</table>

It does as it should, and displays the 4 records from the database.  The thing is, I only want it to display 3 records that would normally display.  What can I do to have it only display 3 records?

 

EDIT: figured it out right away.  MySQL "LIMIT" command.  Nevermind.

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.