I am new to “object oriented” PHP, but so far I have managed to deal with most. I create a website where users can register an account and then add, say, hobbies to their profile.
I was able to determine the creation of a class, an object, saving one user in the database and extracting one user from the database - creating a new object from an associative array, which is returned from SQL "select", a request.
Where am I stuck now, when I need to return multiple rows (records) from the database. For example, a user may have 7 hobbies; The SQL query returns all 7 rows to an associative array (with fields, for example, hobby_id, hobby_name, hobby_created), but how can I make each of these row / hobby entries into my own object?
I tried looking for all kinds of terms, but I don’t know if I will just miss the buzz word I need to find. If anyone could, please let me know how best to do this, I will be forever magnificent.
Thanks a lot Steve
source
share