Skip to content

new SubDistrict

James Cobban edited this page Nov 12, 2019 · 1 revision

new SubDistrict($parms)

Up: class SubDistrict

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('sd_census' => $censusId, 'sd_distId' => $distId, 'sd_Id' => $sdId, 'sd_div' => $division, 'sd_sched' => $sched) 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 'sd_censusid' may also be an instance of class Census.

For example:

$district        = new SubDistrict(array('sd_census'	=> $censusId,
	                                 'sd_distId'	=> $distId ,
                                         'sd_Id'	=> $sdId,
                                         'sd_div'  	=> $division,
                                         'sd_sched'	=> $sched));
$census          = new Census(array('censusid' => 'CA1881'));
$district        = new SubDistrict(array('sd_censusid'  => $census,
	                                 'sd_distId'	=> $distId ,
                                         'sd_Id'	=> $sdId,
                                         'sd_div'  	=> $division,
                                         'sd_sched'	=> $sched));

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

Next: $subdistrict->get()

Clone this wiki locally