本文整理汇总了PHP中DB_test::affected_rows方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_test::affected_rows方法的具体用法?PHP DB_test::affected_rows怎么用?PHP DB_test::affected_rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_test
的用法示例。
在下文中一共展示了DB_test::affected_rows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePassenger
function savePassenger()
{
$logger = Logger::getLogger("airticket");
$logger->info("保存用户信息");
$authorid = trim($this->arr_channelinfo['authorid']); // 必填
if($authorid == "") ErrorReponse :: reponError(array("retcode" => "200", "retmsg" => "用户输入信息不完整"));
$arr_body = $this->arr_body;
$name = trim($arr_body["name"]); // 必填
$cardType = trim($arr_body["cardType"]); // 添加乘机人必填
$cardId = trim($arr_body["cardId"]); // 添加乘机人必填
$phoneNumber = trim($arr_body["phoneNumber"]); // 添加联系人必填
$passengerType = intval($arr_body["passengerType"]); // 添加乘机人必填
if($cardId != "")
{
// 添加乘机人
$sql = "INSERT ignore INTO ctrip_airticket_passenger (user_id, name, card_type, card_id, phone, gender, type) VALUES ('$authorid', '$name', '$cardType', '$cardId', '$phoneNumber', 'M', '$passengerType')";
}
else if($phoneNumber != "")
{
// 添加联系人
$sql = "INSERT ignore INTO ctrip_airticket_contacter (user_id, name, phone) VALUES ('$authorid', '$name', '$phoneNumber')";
}
else
ErrorReponse :: reponError(array("retcode" => "200", "retmsg" => "用户输入信息不完整"));
if(isset($sql))
{
$sql = auto_charset($sql, 'utf-8', 'gbk');
$db = new DB_test();
$result = $db->query($sql);
if($db->affected_rows() > 0)
{
$retcode = "0";
$arr_message = array("result" => "success", "message" => "信息保存成功");
}
else
{
$retcode = "200";
$arr_message = array("result" => "success", "message" => "请勿重复添加信息");
}
}
$arr_msg['msgbody']['result'] = $arr_message['result'];
$arr_msg['msgbody']['message'] = $arr_message['message'];
$returnvalue = array ("msgbody" => $arr_msg['msgbody']);
$returnval = TfbxmlResponse :: ResponsetoApp($retcode, $returnvalue);
return $returnval;
}
示例2: changePayPawdUsingOld
private function changePayPawdUsingOld($authorid, $aunewpwd, $auoldpwd)
{
$logger = Logger::getLogger('AuthorInfo');
$logger->debug("开始通过旧密码修改登录密码");
$db = new DB_test();
$query = "UPDATE tb_author SET fd_author_paypassword = '{$aunewpwd}' WHERE fd_author_id = '{$authorid}' AND fd_author_paypassword = '{$auoldpwd}'";
$logger->debug("sql语句(" . $query . ")");
$db->query($query);
$result = $db->affected_rows();
$logger->debug("sql语句的执行影响了(" . $result . ")条数据");
if ($result == 1) {
return true;
} else {
if ($result > 1) {
$logger->ERR("sql语句(" . $query . ")的执行影响了(" . $result . ")条数据");
}
}
return false;
}