I'm pretty much new to OOP and now that i'm starting to get it I'm pretty excited about the time and energy it will hopefully save me..
Here is some background about my project..
It's really pretty simple. ..
My database only has two tables currently..
Individuals and Groups...
The individuals may or may not be part of a group..
Most of what i'm doing right now with the one class i have is returning information about the individual.
my class right now querys the database and creates properties for all of the fields in teh DB with the constructor.
such as...
Code: Select all
class ind() {
function ind($id) {
dbconnect();
$sql = "select * from ind where id = $id";
$set = mysql_query($sql);
$row = mysql_fetch_array($set);
//here i basically go and set all the object properties...
$this->firstName = $rowї'fname'];
$this->lastName = $rowї'lname'];
// and so on.....
// this happens for address1, address2, city, state, zip, phone, fax, email.. and some other group items as well..
}
}or would that be the best way?
I don't want my object to take up as much memory as i feel it is..
any help is greatly appreciated..
thanks
Will