prepare("SELECT * FROM trains WHERE train_no = ?"); $tq->execute([$no]); $train = $tq->fetch(PDO::FETCH_ASSOC); if (!$train) { http_response_code(404); $page_title = 'Train ' . $no . ' not found'; $meta_robots = 'noindex'; require APP_DIR . '/header.php'; echo '
We don\'t have this train number yet. ' . 'Search journeys instead.
'; require APP_DIR . '/footer.php'; exit; } $sq = $pdo->prepare( "SELECT s.seq, s.station_code, st.name AS sname, s.arrival, s.departure, s.day_offset, s.distance FROM train_stops s LEFT JOIN stations st ON st.code = s.station_code WHERE s.train_no = ? ORDER BY s.seq" ); $sq->execute([$no]); $stops = $sq->fetchAll(PDO::FETCH_ASSOC); $verified = !empty($train['run_days']); $nm = $train['train_name'] ?: ('Train ' . $no); $src = $train['source_code']; $dst = $train['dest_code']; $srcName = $stops[0]['sname'] ?? $src; $dstName = $stops ? ($stops[count($stops) - 1]['sname'] ?? $dst) : $dst; $daysTxt = rr_run_days_text($train['run_days'] ?? null); [$classLabel, $isUn] = rr_classify($no, $train['train_type'] ?? ''); $typeLabel = rr_type_label($train['train_type'] ?? ''); $nStops = count($stops); $totalKm = $stops ? (int) ($stops[count($stops) - 1]['distance'] ?? 0) : 0; $page_title = $no . ' ' . $nm . ' — Time Table & Route'; $meta_description = $no . ' ' . $nm . ' (' . $typeLabel . ') runs ' . $daysTxt . '. Schedule with arrival & departure times for ' . $nStops . ' stations from ' . $srcName . ' to ' . $dstName . '. Indicative times — verify before travel.'; $canonical = rr_abs(rr_train_url($no)); if (!$verified) $meta_robots = 'noindex'; $ld = [ '@context' => 'https://schema.org', '@type' => 'TrainTrip', 'trainNumber' => $no, 'trainName' => $nm, 'departureStation' => ['@type' => 'TrainStation', 'name' => $srcName, 'identifier' => $src], 'arrivalStation' => ['@type' => 'TrainStation', 'name' => $dstName, 'identifier' => $dst], ]; if ($stops) { if (!empty($stops[0]['departure'])) $ld['departureTime'] = substr($stops[0]['departure'], 0, 5); $last = $stops[count($stops) - 1]; if (!empty($last['arrival'])) $ld['arrivalTime'] = substr($last['arrival'], 0, 5); } $crumb = ['@context' => 'https://schema.org', '@type' => 'BreadcrumbList', 'itemListElement' => [ ['@type' => 'ListItem', 'position' => 1, 'name' => 'Home', 'item' => rr_abs('/')], ['@type' => 'ListItem', 'position' => 2, 'name' => $no . ' ' . $nm, 'item' => $canonical], ]]; $head_extra = '' . ''; require APP_DIR . '/header.php'; ?>= e($typeLabel) ?> · = e($srcName) ?> → = e($dstName) ?>
| # | Station | Arr | Dep | Day | Km |
|---|---|---|---|---|---|
| = (int) $st['seq'] ?> | = e($st['sname'] ?: $st['station_code']) ?> (= e($st['station_code']) ?>) | = e($i === 0 ? 'Start' : rr_time($st['arrival'])) ?> | = e($i === $nStops - 1 ? 'End' : rr_time($st['departure'])) ?> | = (int) $st['day_offset'] + 1 ?> | = $st['distance'] !== null ? (int) $st['distance'] : '' ?> |
= e($no . ' ' . $nm) ?> is a = e($typeLabel) ?> running between = e($srcName) ?> (= e($src) ?>) and = e($dstName) ?> (= e($dst) ?>). It operates = e($daysTxt === 'Daily' ? 'daily' : 'on ' . $daysTxt) ?> and calls at = e($nStops) ?> stations. = $isUn ? 'It is an unreserved service — travel on a general / platform ticket; online reservation is not available.' : 'Reserved classes are available for booking through official channels.' ?>
Timings are indicative, based on a reference timetable. Always confirm on the official Indian Railways / IRCTC sources before booking or travel.