本文整理汇总了PHP中DBUtil::connectDB方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::connectDB方法的具体用法?PHP DBUtil::connectDB怎么用?PHP DBUtil::connectDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::connectDB方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateStatusAndPayChannel
public static function updateStatusAndPayChannel($reservationId, $status, $channel = NULL)
{
$connection = DBUtil::connectDB();
$ret = mysql_query("update reservation set status='{$status}',pay_channel='{$channel}' where id={$reservationId}", $connection);
mysql_close();
return $ret;
}
示例2: deleteSet
public static function deleteSet($setId)
{
$con = DBUtil::connectDB();
mysql_query("DELETE FROM consume_set where id={$setId}", $con);
mysql_close();
return mysql_errno() == 0;
}
示例3: updateUser
public static function updateUser($username, $nick, $avatar, $gender)
{
$sentence = '';
if ($nick != NULL) {
$sentence = "nick='{$nick}'";
}
if ($avatar != NULL) {
if (!empty($sentence)) {
$sentence .= ',';
}
$sentence .= "avatar='{$avatar}'";
}
if ($gender != NULL) {
if (!empty($sentence)) {
$sentence .= ',';
}
$sentence .= "gender='{$gender}'";
}
if (empty($sentence)) {
return TRUE;
}
$conn = DBUtil::connectDB();
$result = mysql_query("update user set {$sentence} where username='{$username}'", $conn);
mysql_close();
return $result;
}
示例4: getMarkRecords
public static function getMarkRecords($messageId, $userId)
{
$con = DBUtil::connectDB();
$result = mysql_query("select * from beento where messageId='{$messageId}' AND userId='{$userId}'", $con);
$records = [];
while ($row = mysql_fetch_array($result)) {
$r = [];
$r['destination'] = $row['destination'];
$r['id'] = $row['id'];
$records[] = $r;
}
mysql_close();
return $records;
}
示例5: cancelJoinActivity
public static function cancelJoinActivity($userId, $activityId)
{
$activity = self::getActivityById($activityId);
$userIds = $activity[0]['user_ids'];
foreach ($userIds as $key => $id) {
if ($id == $userId) {
unset($userIds[$key]);
break;
}
}
$newIds = json_encode($userIds);
$conn = DBUtil::connectDB();
$result = mysql_query("update activity set user_ids='{$newIds}' where id={$activityId}", $conn);
mysql_close();
return $result != FALSE ? TRUE : FALSE;
}