I am trying to do what I just said. I have two joined tables. They are joined by same id\'s. But There are two columns with same name and I only want to output one of the co
Using SELECT *
is generally considered harmful in production software, especially in php, for the precise reason you're asking about.
In php, sometimes the result set is loaded into an associative array. That will cause data from all but one of each set of duplicate column names to disappear.
You want to use
SELECT products.id,
products.productname,
products.id AS product_id,
bookings.*,
etc., etc.
to enumerate the columns you need in your result set. (Notice that I'm guessing at your column names).
I know your question says you have to use SELECT *
. I doubt that's true. If so it's a likely to be requirement imposed by somebody who doesn't know what they're talking about. (Stupid professor tricks come to mind.)
If you do have to use SELECT *
, you'll need to use the result set metadata to examine each column's metadata and figure out which columns you need to extract. getColumnMeta() does that.