I use pdo to pull queries down from MySQL which has worked fine by using
$rs->fetchAll(PDO::FETCH_ASSOC);
The problem is when there is no rows to retrieve it returns an empty array (which I understand is right), however is there a way I can return the structure (the fields that would be returned) and if possible have the field values as null, so long as the fieldnames are available in the returned array
So, for example:-
SELECT * FROM `modules` WHERE `moduleID` =1;
Which returns 1 row:-
Array
(
[moduleID] => 1
[title] => Employees and Contractors
[permissionPath] => NULL
[order] => 100
[colorHex] => 436D5D
)
What I would like it is to use a query like:-
SELECT * FROM `modules` WHERE `moduleID` IS NULL
Which returns 0 rows:-
And Id like the returned array to be:-
Array
(
[moduleID] => NULL
[title] => NULL
[permissionPath] => NULL
[order] => NULL
[colorHex] => NULL
)
Is this even possible