Hi...
I hope my title made sense... heh.
What I am trying to do is populate a menu from a database query, separating the results by two colons. The only problem is that, with my current code, I end up having two colons at the end of the menu... which I don't want. I need to find a way to strip the two extra colons from the variable.
My code is like this so far :
$hubs = "SELECT * FROM hub";
$hubs_result = @mysql_query($hubs, $connect) or die(mysql_error());
while ($row_hub = mysql_fetch_array($hubs_result)) {
$hub_id = $row_hub['hub_id'];
$hub_icao = $row_hub['hub_icao'];
$hub_ap = $row_hub['hub_ap'];
$hub_desc = $row_hub['hub_desc'];
$display_sublinks .= "
<a href=index.php?content=hub&hub=$hub_id>($hub_icao) $hub_ap</a>
<font color=Gray>::</font>";
Now, this works fine, until the last result found in the table.
So, for example, if I have 4 resultsets here, I'll end up with the following on the page itself :
RESULT1 :: RESULT2 :: RESULT3 :: RESULT4 ::
I need to find a way to strip that last set of double colons from the result.
I've tried to use substr() to remove them, but I've had little luck. Searching through the forums and the PHP manual has yeilded a wealth of information pertaining to the command substr(), but nothing that really helps my situation (at least, nothing that jumped out at me).
Can anyone give me some advice on how to deal with this? Am I going about this the wrong way perhaps?