Custom object based on database table
Posted
by Archangel
on Stack Overflow
See other posts from Stack Overflow
or by Archangel
Published on 2010-06-08T22:13:11Z
Indexed on
2010/06/08
22:22 UTC
Read the original article
Hit count: 222
php
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?
© Stack Overflow or respective owner