Custom object based on database table
- by Archangel
Suppose that I have a database query which looks like below -
select name, gender, birthday from person where person_id = 1;
When this query is executed, some records from the database are returned. I want to make a custom object which will contain the exact attributes as the column names, with the corresponding values. As an example, suppose that the object is X. So it will have three attributes which are X.name, X.gender and X.birthday, with the corresponding values from the records.
Is it doable in PHP? If so, then how?