I'm trying to do some database stuff with classes. I've created the following class but it won't parse and fails with: (T_OLD_FUNCTION' or T_FUNCTION' orT_VAR'. I'm using PHP 4.
Any ideas?
class user {
public $c_clientid;
public $c_fname;
public $lname;
public $ssn1;
public $ssn2;
public $ssn3;
public $createdate;
public $addr1;
public $addr2;
public $city;
public $state;
public $zip;
public $dobm;
public $dobd;
public $doby;
public $areacode;
public $phone;
public $race;
public $sex;
public $homeless;
public $employed;
public $wincome;
public $salary;
public $csupport;
public $ssincome;
public $tanif;
public function insert ()
{
if ($this->userid {
throw new Exception("User object has a userid");
}
$query = "insert into user_basic
clientid, fname, lname, ssn1, ssn2, ssn3, createdate, addr1, addr2, city, state, zip, dobm, dobd,
doby, areacode, phone, race, sex, homeless, employed, wincome, salary, csupport, ssincome, tanif)
VALUES(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19,
:20, :21, :22, :23, :24, :25, :26)";
$dbh = new DB_Mysql_Test;
$dbh->prepare($query)->execute($this->clientid, $this->fname, $this->lname, $this->ssn1, $this->ssn2,
$this->ssn3, $this->createdate, $this->addr1, $this->addr2, $this->city, $this->state,
$this->zip, $this->dobm, $this->dobd, $this->doby, $this->areacode, $this->phone,
$this->race, $this->sex, $this->homeless, $this->employed, $this->wincome, $this->salary,
$this->csupport, $this->ssincome, $this->tanif);
}
}