How to get fields (columns' names) of a table?

Re: How to get fields (columns' names) of a table?

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This still sounds like a situation whereby you would be better off manually creating a default object:

$default = (object)['username' => null, 'firstname' => null, 'lastname' => null, ... ];

Rather than relying on tricks to automatically create the object. But, at least I now understand your use-case for what you wanted to do.


Average of ratings: Useful (1)