Skip to content

new District

James Cobban edited this page Nov 27, 2019 · 4 revisions

new District($parms)

Up: class District

The constructor for an instance of District takes one parameter:

parameter description
$parms identifies the database record to be associated with this instance. This is an associative array.

$parms may be:

  • An associative array containing all of the fields in a record as obtained by a database SELECT.
  • array('censusid' => string, 'id' => number) specifies the unique identifier of the record in the table that is to be used to initialize the new instance. The value of the parameter 'censusid' may also be an instance of class Census.

For example:

$district        = new District(array('censusid' => 'CA1881', 'id' => 54));
$census          = new Census(array('censusid' => 'CA1881'));
$district        = new District(array('censusid' => $census, 'id' => 54));

The constructor adds error messages to $record->msg if it is unable to complete due to bad parameters.

Next: $district->get($fieldname)

Clone this wiki locally