This question already has an answer here:
fetching an assoc-array with PDO seems to not show all resulting columns when joining tables.
<?php
$stmt = $GLOBALS['db']->prepare("
SELECT *
FROM printer
, printermanufacturer
, printermodel
, colorprofile
, papersize
WHERE User = :userID
AND printer.Manufacturer = printermanufacturer.ID
AND printer.Model = printermodel.ID
AND printer.Colorprofile = colorprofile.ID
AND printer.papersize = papersize.ID
");
$stmt->bindValue(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
?>
This should result in an associative array with e.g. printermanufacturer.Name and printermodel.Name, but it doesn't. There is only one row called Name.
Is there a solution without renaming each and every column like SELECT printermanufacturer.Name AS pmName ...
Thanks
edit: In the duplicate question there was also the (unanswered) question about: "is there a way to automatically have the t2 columns be identified as t2.col1, t2.col2, (etc)" Is this possible?
</div>