Child::save - jcobban/Genealogy GitHub Wiki

$child->save($xml)

Up: class Child

This method updates the record contents in the database server. If previously detected errors have been accumulated in $this‑>msg this method suppresses the update, generates a warning that includes the text of the messages to explain why the record was not updated, and returns 0. If $child‑>isExisting() is false this inserts a new record into the table. The value of the primary key is not passed in the INSERT as it is an auto-increment field, whose value will be determined by the database server. If $child->isExisting() is true the existing database record is updated. This method extends the base implementation by suppressing the update if the idir field has not been initialized.

parameter description
$xml If the value is boolean true then a representation of the SQL command issued to update the database is printed on the output enclosed in an XML <cmd> tag. If the value is the constant Record::JSON the SQL command is printed enclosed in JSON. If the value is a string then the representation of the SQL command issued to update the database is printed on the output enclosed in an XML <$xml> tag. If the leading characters of the string contain spaces these are extracted and used as an indentation value before the tag and end-tag. If there are any characters after a valid XML tag name these are extracted and presented only in the opening tag. If this parameter is omitted or boolean false no output is generated.

For example if the text is to be displayed as part of a web page you may set the parameter to 'p' or " p class='cssclassname'".

The method returns boolean false if the method was unable to update the database. It returns 1 if the method inserted or updated the database record, and $child->getLastSqlCmd() may be called to get the actual SQL command issued to update the database. It returns 0 if the database did not need to be updated because there were no changes to the record.

Next: $child->getFamily()

⚠️ **GitHub.com Fallback** ⚠️