本文整理汇总了PHP中Addresses::withID方法的典型用法代码示例。如果您正苦于以下问题:PHP Addresses::withID方法的具体用法?PHP Addresses::withID怎么用?PHP Addresses::withID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Addresses
的用法示例。
在下文中一共展示了Addresses::withID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAddress
function updateAddress($addr, $keep_photo = true)
{
global $keep_history, $domain_id, $base_from_where, $table, $table_grp_adr, $table_groups, $only_phone;
$addresses = Addresses::withID($addr['id']);
$resultsnumber = $addresses->count();
$homepage = str_replace('http://', '', $addr['homepage']);
$is_valid = $resultsnumber > 0;
if ($is_valid) {
if ($keep_history) {
// Get current photo, if "$keep_photo"
if ($keep_photo) {
$r = $addresses->nextAddress()->getData();
$addr['photo'] = $r['photo'];
}
$sql = "UPDATE {$table}\n\t SET deprecated = now()\n\t\t WHERE deprecated is null\n\t\t AND id\t = '" . $addr['id'] . "'\n\t\t AND domain_id = '" . $domain_id . "';";
$result = mysql_query($sql);
saveAddress($addr);
} else {
$sql = "UPDATE {$table} SET firstname = '" . $addr['firstname'] . "'\n\t , lastname = '" . $addr['lastname'] . "'\n\t , middlename = '" . $addr['middlename'] . "'\n\t , nickname = '" . $addr['nickname'] . "'\n\t , company = '" . $addr['company'] . "'\n\t , title = '" . $addr['title'] . "'\n\t , address = '" . $addr['address'] . "'\n\t , home = '" . $addr['home'] . "'\n\t , mobile = '" . $addr['mobile'] . "'\n\t , work = '" . $addr['work'] . "'\n\t , fax = '" . $addr['fax'] . "'\n\t , email = '" . $addr['email'] . "'\n\t , email2 = '" . $addr['email2'] . "'\n\t , email3 = '" . $addr['email3'] . "'\n\t , homepage = '" . $addr['homepage'] . "'\n\t , aday = '" . $addr['aday'] . "'\n\t , amonth = '" . $addr['amonth'] . "'\n\t , ayear = '" . $addr['ayear'] . "'\n\t , bday = '" . $addr['bday'] . "'\n\t , bmonth = '" . $addr['bmonth'] . "'\n\t , byear = '" . $addr['byear'] . "'\n\t , address2 = '" . $addr['address2'] . "'\n\t , phone2 = '" . $addr['phone2'] . "'\n\t , notes = '" . $addr['notes'] . "'\n\t " . ($keep_photo ? "" : ", photo = '" . $addr['photo'] . "'") . "\n\t , modified = now()\n\t\t WHERE id = '" . $addr['id'] . "'\n\t\t AND domain_id = '{$domain_id}';";
$result = mysql_query($sql);
}
// header("Location: view?id=$id");
}
return $is_valid;
}