Extra 2 random parts of array

I’m building a train timetable site, using jquery mobile. On each station page it comes up with the services departing that station, each service being a collapsible header, and when it is clicked on it brings up the full list of stations on that run, and how long until the train arrives at each station. It’s all working fine for the first one, but for all the others, there are 2 random instances before the proper list begins, the first being a capital letter and the next being a number. It’s probably easier to explain with screenshots so - First one (works fine) [php]https://www.dropbox.com/s/ty5xvbyrovbi9lr/Screenshot%202014-01-09%2009.40.56.png[/php], Second one (random bits, all others after this are the same, but the letter and number change seemingly randomly) [php]https://www.dropbox.com/s/afis4wgkfmfn0uo/Screenshot%202014-01-09%2009.41.11.png[/php].

That no links until 10 posts is really annoying

After further examination, the letter seems to be the first letter of the service before the clicked one (So if the first one starts with B, then the random letter will be B for the second one). The number is the starting number of the time until the train terminates on the service prior (so if it terminates in 70 minutes, the number is 7, if it is in 4 hours, it is 4 (I have it so it rounds to hours once the hours is 2 or more)). Why is it doing that and more importantly how do I get rid of them?

Code:
[php]// ^ start of html document, connect to db etc.
<?php

try {
	$sql = "SELECT timetable.id as id, day, station, departs as time, CURTIME(), ROUND(TIME_TO_SEC(departs)/60 - TIME_TO_SEC(CURTIME())/60,0) as departs, platform, route, run, route.code, line.name, station.name as terminus, line.colour FROM timetable INNER JOIN route ON timetable.route = route.id INNER JOIN line ON route.line = line.id INNER JOIN station ON route.terminus = station.id WHERE station = " . $_GET['id'] . " AND day LIKE '%" . date('N') . "%' AND departs > CURTIME() ORDER BY time ASC";
	$s = $pdo->prepare($sql);
	$s->execute();
}
catch (PDOException $e){
	
}

foreach($s as $row){
	$services[] = array('id' => $row['id'], 'time' => $row['time'], 'platform' => $row['platform'], 'terminus' => $row['terminus'], 'colour' => $row['colour'], 'departs' => $row['departs'], 'route' => $row['route'], 'run' => $row['run']);
}



?>
<body>
<!-- Home -->
<div data-role="page" id="homepage">
	<div data-theme="a" data-role="header" align="center">
        <a data-role="button" data-transition="none" href="search.php"
            class="ui-btn-left" data-icon="arrow-l" data-ajax="false">
            Back
        </a>
    	<h3>
        	<?php echo $name;?> Station
        </h3>
    </div>
    <div data-role="content">
    	<div style=" text-align:center" data-controltype="image" id="stationpic">
            <img style="width: 300px; height: px" src="images/<?php echo $name;?> Station.jpg">
        </div>
        <ul data-role="listview" data-divider-theme="b" data-inset="true">
            <li data-theme="a" data-icon="false">
            	<?php if(isset($services)){?>
                <div data-role="collapsible-set">
                	<table style="width:100%; color:#ffffff !important; text-align:left !important;">
                            	<tr><td style="width:15%; padding-left:5%;">Service</td><td style="width:55%;">Destination</td><td style="width:15%;">Platform</td><td style="width:15%;">Departs</td></tr>
                    </table>

                	<?php for($i = 0; $i < count($services); $i++){?>
                    
                    <div data-role="collapsible" data-collapsed="true" data-theme="none" style="background-color:<?php echo $services[$i]['colour'];?>; background-image:none !important;">
                        <h3>
                            <table style="width:100%; color:#ffffff !important; text-align:left !important;">
                            	<tr><td style="width:15%;"><?php echo $services[$i]['time'];?></td><td style="width:55%;"><?php if($services[$i]['terminus'] == $name){ echo 'Terminating Service'; } else { echo $services[$i]['terminus']; }?></td><td style="width:15%;"><?php echo $services[$i]['platform'];?></td><td style="width:15%;"><?php if($services[$i]['departs'] >= 120){ echo floor($services[$i]['departs']/60) . ' hrs'; } else { echo $services[$i]['departs'] . ' min'; }?></td></tr>
                            </table>
                        </h3>
                        <?php 
						try {
							$stations = "SELECT station.name as station, ROUND(TIME_TO_SEC(departs)/60 - TIME_TO_SEC(CURTIME())/60,0) as departs FROM timetable INNER JOIN station ON timetable.station = station.id WHERE route = " . $services[$i]['route'] . " AND run = " . $services[$i]['run'] . " AND departs > '" . $services[$i]['time'] . "' ORDER BY departs ASC";
							$z = $pdo->prepare($stations);
							$z->execute();
						}
												
						catch (PDOException $error){
							
						}
												
						foreach($z as $z){
							$stops[] = array('station' => $z['station'], 'departs' => $z['departs']);
						}
						if(isset($stops)){
							foreach($stops as $stops){
								if($stops['departs'] >= 120){
									$stops['departs'] = floor($stops['departs']/60) . ' hrs';
								} else {
									$stops['departs'] = $stops['departs'] . ' min';
								}
								echo '<div style="margin-left:15%;">' . $stops['station'] . ' - ' . $stops['departs'] . '</div>';
							}
						}?>
                        <!--Further Trip Details Coming Soon-->
                        
                    </div>
                    <?php } ?>
                </div>
                <?php } else {?>
                No Services For The Rest Of Today
                <?php } ?>
            </li>
        </ul>
    </div>
    <div data-role="footer" data-theme="a">
    	<h3>Copyright</h3>
    </div>
</div>
</body>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service