Skip to content

Surname::save

James Cobban edited this page Mar 24, 2022 · 3 revisions

$surname->save($xml)

Up: class Surname

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 $surname‑>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 $surname->isExisting() is true the existing database record is updated. This method extends the base implementation by ensuring that the 'SoundsLike' field is adjusted to match the value of the 'surname' field.

parameter description
$xml Deprecated parameter to control diagnostic output written into the output.

Where existing code invokes this method with a parameter other than false change the parameter to false and call either $surname->toXml or $surname->toJson.

The method returns boolean false if the method was unable to update the database, 1 if the method updated the database record, or 0 if the database did not need to be updated because there were no changes to the record.

The method throws an Exception if user is not authorized to update the database.

Next: Surname::getInitials($options)

Clone this wiki locally