this is the first time I try OOP, and I'm not skilled in English so sorry for errors.
I want to manage a list of people in my database with a lot of attributes, I have to extract all the records or save single one. I'm trying to create a class with all the attributes but I don't know how to initialize the single object because I think creating a constructor with so many parameters is not the correct way. I need a suggestion please. Thanks a lot.
Francesco
EDIT: an example of what I should do.
class Person {
var $id=NULL;
var $name;
var $lastname;
var $cf;
var $address;
var $number;
var $city;
var $cap;
var $state;
var $nation;
var $phone;
var $fax;
var $cell;
var $email;
var $reg_date;
var $reg_type;
function __constructor(... attributes ...){
... assignements ...
}
function getPerson($id){
$result=mysql_query("SELECT * FROM .... ");
if(mysql_num_rows($result)!=1) return false;
$record = mysql_fetch_assoc($result);
$this->id=$record['id'];
$this->name=$record['name'];
ecc ...
}
}
I need to create a Person object with the data sent by a web form in POST mode.