本文整理匯總了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;
}