Generating objects from a MySQL select statement
View Single Post
05-18-2009, 08:27 PM
Join Date: Feb 2009
Location: New York
Originally Posted by
I assume i wouldnt be instantiating an object if it was a static method. Not really understanding your explantion. If i have mysql table with 10 rows in it each row being one of my favourite films with each column storing various info on that film and i want to recall all rows for display on a page i would, for example, have the query "select * from films". How do i handle this from an OO perspective. Do i run the select then loop through th results instantiating an object for each row and calling a method to display the objects? I could stick the query in a static method within the class. Dunno if i'm making sense but i assume this is one of the most fundamental situations in OOP but i'm clueless any guidance appreciated.
Oh I see, so you want to do this statically without creating any objects right?
View Public Profile
Send a private message to allworknoplay
Find More Posts by allworknoplay