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
https://forums.phpfreaks.com/topic/153535-query-only-returning-one-result/
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.