本文整理汇总了PHP中person::save方法的典型用法代码示例。如果您正苦于以下问题:PHP person::save方法的具体用法?PHP person::save怎么用?PHP person::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person
的用法示例。
在下文中一共展示了person::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$person->vorname = $_POST['vorname'];
$person->vornamen = $_POST['vornamen'];
$person->gebdatum = $datum_obj->formatDatum($_POST['gebdatum'], 'Y-m-d');
$person->gebort = $_POST['gebort'];
$person->gebzeit = $_POST['gebzeit'];
$person->anmerkungen = $_POST['anmerkungen'];
$person->homepage = $_POST['homepage'];
$person->svnr = $_POST['svnr'];
$person->ersatzkennzeichen = $_POST['ersatzkennzeichen'];
$person->familienstand = $_POST['familienstand'];
$person->geschlecht = $_POST['geschlecht'];
$person->anzahlkinder = $_POST['anzahlkinder'];
$person->aktiv = isset($_POST['aktiv']);
$person->updateamum = date('Y-m-d H:i:s');
$person->updatevon = $user;
if ($person->save(false)) {
echo '<b>Daten wurden erfolgreich gespeichert</b>';
} else {
echo "<b>Fehler beim Speichern der Daten: {$person->errormsg}</b>";
}
}
if (isset($_GET['action']) && $_GET['action'] == 'neuezuordnung') {
//speichern einer neue Studiengangszuordnung
$zuordnung = new preinteressent();
if (!$zuordnung->loadZuordnung($preinteressent->preinteressent_id, $_POST['studiengang_kz'])) {
$zuordnung->preinteressent_id = $preinteressent->preinteressent_id;
$zuordnung->studiengang_kz = $_POST['studiengang_kz'];
$zuordnung->prioritaet = $_POST['prioritaet'];
$zuordnung->insertamum = date('Y-m-d H:i:s');
$zuordnung->insertvon = $user;
if (!$zuordnung->saveZuordnung(true)) {
示例2: int
ADOdb_Active_Record::SetDatabaseAdapter($db);
$db->Execute("CREATE TEMPORARY TABLE `persons` (\r\n\t `id` int(10) unsigned NOT NULL auto_increment,\r\n\t `name_first` varchar(100) NOT NULL default '',\r\n\t `name_last` varchar(100) NOT NULL default '',\r\n\t `favorite_color` varchar(100) NOT NULL default '',\r\n\t PRIMARY KEY (`id`)\r\n\t ) ENGINE=MyISAM;\r\n\t ");
$db->Execute("CREATE TEMPORARY TABLE `children` (\r\n\t `id` int(10) unsigned NOT NULL auto_increment,\r\n\t\t\t\t\t`person_id` int(10) unsigned NOT NULL,\r\n\t `name_first` varchar(100) NOT NULL default '',\r\n\t `name_last` varchar(100) NOT NULL default '',\r\n\t `favorite_pet` varchar(100) NOT NULL default '',\r\n\t PRIMARY KEY (`id`)\r\n\t ) ENGINE=MyISAM;\r\n\t ");
$db->Execute("insert into children (person_id,name_first,name_last) values (1,'Jill','Lim')");
$db->Execute("insert into children (person_id,name_first,name_last) values (1,'Joan','Lim')");
$db->Execute("insert into children (person_id,name_first,name_last) values (1,'JAMIE','Lim')");
ADODB_Active_Record::TableHasMany('persons', 'children', 'person_id');
class person extends ADOdb_Active_Record
{
}
$person = new person();
# $person->HasMany('children','person_id'); ## this is affects all other instances of Person
$person->name_first = 'John';
$person->name_last = 'Lim';
$person->favorite_color = 'lavender';
$person->save();
// this save will perform an INSERT successfully
$person2 = new person();
$person2->Load('id=1');
$c = $person2->children;
if (is_array($c) && sizeof($c) == 3 && $c[0]->name_first == 'Jill' && $c[1]->name_first == 'Joan' && $c[2]->name_first == 'JAMIE') {
echo "OK Loaded HasMany</br>";
} else {
var_dump($c);
echo "error loading hasMany should have 3 array elements Jill Joan Jamie<br>";
}
class child extends ADOdb_Active_Record
{
}
ADODB_Active_Record::TableBelongsTo('children', 'person', 'person_id', 'id');
$ch = new Child('children', array('id'));
示例3: kontakt
$active = 'allgemein';
}
// Persönliche Daten speichern
if (isset($_POST['btn_person'])) {
$person->titelpre = $_POST['titel_pre'];
$person->vorname = $_POST['vorname'];
$person->nachname = $_POST['nachname'];
$person->titelpost = $_POST['titel_post'];
$person->gebdatum = $datum->formatDatum($_POST['geburtsdatum'], 'Y-m-d');
$person->staatsbuergerschaft = $_POST['staatsbuergerschaft'];
$person->geschlecht = $_POST['geschlecht'];
$person->svnr = $_POST['svnr'];
$person->gebort = $_POST['gebort'];
$person->geburtsnation = $_POST['geburtsnation'];
$person->new = false;
if (!$person->save()) {
$message = 'Fehler beim Speichern der Person aufgetreten';
}
if ($person->checkSvnr($person->svnr)) {
$message = "SVNR bereits vorhanden";
}
}
// Kontaktdaten speichern
if (isset($_POST['btn_kontakt'])) {
$kontakt = new kontakt();
$kontakt->load_persKontakttyp($person->person_id, 'email');
// gibt es schon kontakte von user
if (count($kontakt->result) > 0) {
// Es gibt bereits einen Emailkontakt
$kontakt_id = $kontakt->result[0]->kontakt_id;
if ($_POST['email'] == '') {
示例4: resize
//groesse auf maximal 101x130 begrenzen
resize($tmpfname, 101, 130);
//in DB speichern
//File oeffnen
$fp = fopen($tmpfname, 'r');
//auslesen
$content = fread($fp, filesize($tmpfname));
fclose($fp);
//in base64-Werte umrechnen
$content = base64_encode($content);
$person = new person();
if ($person->load($person_id)) {
//base64 Wert in die Datenbank speichern
$person->foto = $content;
$person->new = false;
if ($person->save()) {
$fs = new fotostatus();
$fs->person_id = $person->person_id;
$fs->fotostatus_kurzbz = 'hochgeladen';
$fs->datum = date('Y-m-d');
$fs->insertamum = date('Y-m-d H:i:s');
$fs->insertvon = $user;
$fs->updateamum = date('Y-m-d H:i:s');
$fs->updatevon = $user;
if (!$fs->save(true)) {
echo '<span class="error">Fehler beim Setzen des Bildstatus</span>';
} else {
echo "<b>Bild wurde erfolgreich gespeichert</b>";
}
} else {
echo '<b>' . $person->errormsg . '</b><br />';
示例5: person
} else {
if ($method == "profil") {
// Profil speichern
if (isset($_POST['submit_profil'])) {
$save = true;
$emergencyPerson = new person();
if ($_REQUEST['emergency_name_id'] == "" && $_REQUEST['emergency_nachname'] != "") {
// Emergency Person
$emergencyPerson->vorname = $_REQUEST['emergency_vorname'];
$emergencyPerson->nachname = $_REQUEST['emergency_nachname'];
$emergencyPerson->geschlecht = "u";
$emergencyPerson->new = true;
$emergencyPerson->aktiv = true;
$emergencyPerson->updateamum = date('Y-m-d H:i:s');
$emergencyPerson->insertamum = date('Y-m-d H:i:s');
if (!$emergencyPerson->save()) {
echo $emergencyPerson->errormsg;
die($p->t('global/fehleraufgetreten'));
}
// in preincoming speichern
$preincoming->person_id_emergency = $emergencyPerson->person_id;
$preincoming->updateamum = date('Y-m-d H:i:s');
} else {
if ($_REQUEST['emergency_name_id'] != "" && $_REQUEST['emergency_nachname'] == "" && $_REQUEST['emergency_vorname'] == "") {
// löscht die Person
$preincoming->person_id_emergency = "";
if (!$preincoming->save()) {
die($p->t('global/fehleraufgetreten'));
}
if (!$emergencyPerson->delete($_REQUEST['emergency_name_id'])) {
echo $emergencyPerson->errormsg;
示例6: person
function store_prefs()
{
$p = new person();
$p->set_id($this->get_id());
$p->select();
$p->load_prefs();
$old_prefs = $p->prefs or $old_prefs = array();
foreach ($old_prefs as $k => $v) {
if ($this->prefs[$k] != $v) {
$save = true;
}
}
foreach ($this->prefs as $k => $v) {
if ($old_prefs[$k] != $v) {
$save = true;
}
}
if ($save || (!is_array($old_prefs) || !count($old_prefs))) {
$arr = serialize($this->prefs);
$p->set_value("sessData", $arr);
$p->currency = config::get_config_item('currency');
$p->save();
}
}