Jump to content

PHP Rankings


jason97673

Recommended Posts

Not sure of the exact terminology for this, but I have a set of data in the database. About ten or so records are returned. I want the first row to display

 

1. ---Data returned

2. ---Data returned

etc

 

I know this involves a loop just unsure how to do this.

 

Thanks.

Link to comment
Share on other sites

Eh well actually I have something similar to this. This is my code

while($row = mysql_fetch_array($data))
{
echo  '<tr><td><a href="/data/profile.php?profileID=' .$row['id'] .'">' .$row['first'] .' ' .$row['last'] .'</a></td>';
echo '<td>' .$row['cmp'] .'</td>';
echo '<td>' .$row['att'] .'</td>';
echo '<td>' .$row['cmppct'] .'%</td>';
echo '<td>' .$row['yards'] .'</td>';
echo '<td>' .$row['ypa'] .'</td>';
echo '<td>' .$row['td'] .'</td>';
echo '<td>' .$row['tdpct'] .'%</td>';
echo '<td>' .$row['interceptions'] .'</td>';
echo '<td>' .$row['intpct'] .'%</td>';
echo '<td>' .$row['rating'] .'</td></tr>';
}

 

But I actually want each of the results returned to display the actual NUMBER such as 1, 2, 3, etc.

Link to comment
Share on other sites

try

 

<ol>
<?php
while($row = mysql_fetch_array($data))
{
echo '<li>';
echo  '<tr><td><a href="/data/profile.php?profileID=' .$row['id'] .'">' .$row['first'] .' ' .$row['last'] .'</a></td>';
echo '<td>' .$row['cmp'] .'</td>';
echo '<td>' .$row['att'] .'</td>';
echo '<td>' .$row['cmppct'] .'%</td>';
echo '<td>' .$row['yards'] .'</td>';
echo '<td>' .$row['ypa'] .'</td>';
echo '<td>' .$row['td'] .'</td>';
echo '<td>' .$row['tdpct'] .'%</td>';
echo '<td>' .$row['interceptions'] .'</td>';
echo '<td>' .$row['intpct'] .'%</td>';
echo '<td>' .$row['rating'] .'</td></tr>';
echo '</li>';
}
?>
</ol>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.