Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print rows where table names contains object in SQL?

Tags:

sql

php

How do I print rows where table names contains object, here printing of 'A.arrival' is not happening.

echo "arrival :" .$row['A.arrival'] ."."
like image 262
Athul Raj Avatar asked Nov 28 '25 14:11

Athul Raj


1 Answers

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'].

like image 77
Barmar Avatar answered Nov 30 '25 03:11

Barmar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!