Hey, I have a code that gets the game categories for my site. I got it so if there is one entry in the table then it doesn't display a '-', but if there is more than one then it will display the '-'.
The problem is, I can't get them to stop.
The above code currently displays:
Arcade is the last entry in the table. As you can see, after Arcade there is a '-'. Is it possible to have the last '-' removed if Arcade (or any other entry) is the last entry in the table?
I hope you understand, many thanks.
The problem is, I can't get them to stop.
| Code: |
| <?php
error_reporting(0); include("../members/config.php"); $select1 = mysql_query("SELECT * FROM `cats`"); while ($select = mysql_fetch_array($select1)) { $id = $select['id']; $total = $select['tp']; $name = $select['name']; $howmany = mysql_num_rows($select1); if($howmany == 1) { echo "<a href='games.php?id=$id' alt='Total Games in Category: $total' title='Total Games in Category: $total'>$name</a> - $howmany"; } else if($howmany >= 2) { echo "<a href='games.php?id=$id' alt='Total Games in Category: $total' title='Total Games in Category: $total'>$name</a> - "; } } ?> |
The above code currently displays:
| Web wrote: |
| Action - Arcade - |
Arcade is the last entry in the table. As you can see, after Arcade there is a '-'. Is it possible to have the last '-' removed if Arcade (or any other entry) is the last entry in the table?
I hope you understand, many thanks.
