Jump to content

Query only returning one result ???


jandrews

Recommended Posts

Hey,

 

Does anyone know why this query would only return one row in a table?

 <?php require_once('Connections/top50.php'); ?>
<?php
$maxRows_top50 = 10;
$pageNum_top50 = 0;
if (isset($_GET['pageNum_top50'])) {
  $pageNum_top50 = $_GET['pageNum_top50'];
}
$startRow_top50 = $pageNum_top50 * $maxRows_top50;

mysql_select_db($database_top50, $top50);
$query_top50 = "SELECT hits, title_music, playlist_music FROM flamplayer_musics ORDER BY hits DESC";
$query_limit_top50 = sprintf("%s LIMIT %d, %d", $query_top50, $startRow_top50, $maxRows_top50);
$top50 = mysql_query($query_limit_top50, $top50) or die(mysql_error());
$row_top50 = mysql_fetch_assoc($top50);

if (isset($_GET['totalRows_top50'])) {
  $totalRows_top50 = $_GET['totalRows_top50'];
} else {
  $all_top50 = mysql_query($query_top50);
  $totalRows_top50 = mysql_num_rows($all_top50);
}
$totalPages_top50 = ceil($totalRows_top50/$maxRows_top50)-1;

mysql_free_result($top50);
?>
</p>


<table width="100%" cellpadding="3" cellspacing="2">
  <tr>
    <td align="center" bgcolor="#121212"><div align="center">Song</div></td>
    <td align="center" bgcolor="#121212"><div align="center">Band</div></td>
    <td align="center" bgcolor="#121212">Plays</td>
  </tr>
  <?php do { ?>
    <tr>
      <td bgcolor="#666666"><a href="../band.php?music=<?php echo urlencode($row_top50['playlist_music']); ?>" class="style2"><a href="backing_track.php?track=<?php echo urlencode($row_top50['title_music']); ?>"> <?php echo ucfirst($row_top50['title_music']); ?></a></td>
      <td bgcolor="#666666"><a href="../band.php?music=<?php echo urlencode($row_top50['playlist_music']); ?>" class="style2"><?php echo ucfirst($row_top50['playlist_music']); ?></a></td>
      <td align="center" bgcolor="#666666"><?php echo $row_top50['hits']; ?></td>
    </tr>
    <?php } while ($row_top50 = mysql_fetch_assoc($top50)); ?>
</table>

 

Any help would be great.

 

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.