how to print A.station_id from given code
$query="SELECT A.train_no, A.station_id, A.arrival, A.dept, B.station_id, B.arrival, B.dept FROM TIME A,TIME B WHERE A.train_no = B.train_no AND A.station_id ='KNR' AND B.station_id='CLT' ";
$rs=mysql_query($query);
while($row = mysql_fetch_array($rs)) {
echo "</td><td>".$row['A.station_id']."</td> <td>" .$row['A.arrival'] ."</td> <td>".$row['A.dept'] . "</td><td>".$row['B.station_id'] . "</td> <td>".$row['B.arrival'] ."</td><td>" .$row['B.dept']. "</td><td>";
}
Most database APIs don't include the table name in the associative array keys. So you should just use $row['arrival'].
If your query is returning two arrival columns from different tables, you should give one or both of them a different alias, e.g.
SELECT a.arrival AS a_arrival, b.arrival AS b_arrival, ... Then you can refer to them as $row['a_arrival'] and $row['b_arrival'].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With