本文整理汇总了PHP中DBConnection::Connect方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::Connect方法的具体用法?PHP DBConnection::Connect怎么用?PHP DBConnection::Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection::Connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/order.css?v=0.0.1" />
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
<!--script type="text/javascript" src="js/order.js"></script-->
</head>
<body>
<?php
if (isset($_POST["txtComputer2"])) {
} else {
if (count($computers) == 1) {
$user_name = User::GetCookie_UserName();
DBConnection::Connect();
Computer::Order($computers[0], $user_name);
DBConnection::Close();
// Yes, not valid html, but browsers can handle it, and we are out of time :(
?>
<div class="ordered">
Your order is reserved!
<br />
Happy programming!
<br />
<br />
<input type="button" value="Close" onclick="window.parent.location.href = window.parent.location.href;" />
</div>
<?php
} else {
?>
示例2: DBConnection
<?php
include_once 'includes/connection.php';
include_once 'includes/database.class.php';
/************ Class Object Define ***************/
$DBObj = new DBConnection();
$MSObj = new FuncMySql();
$ErObj = new Error();
$ThubObj = new UserFunction();
/************************************************/
$DBObj->Connect($SERVER_HOST, $SERVER_USER, $SERVER_PASSWORD, $SERVER_DATABASE);
$fid = $_POST['fid'];
$donation_amount = $_POST['donation_amount'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$message = $_POST['message'];
$donation_amount = number_format($donation_amount, 2, '.', '');
$mycharityfees = $donation_amount * 5.9 / 100;
$mycharityfees = number_format($mycharityfees, 2, '.', '');
//$centplus=(($donation_amount*0.30)/100);
$centplus = '0.30';
//$centplus=number_format($centplus, 2, '.', '');
$mycharityfees = $mycharityfees + $centplus;
$total_donation = $donation_amount - $mycharityfees;
$status = '0';
$insert_date = date('Y-m-d h:i:s');
$query = sprintf("INSERT into cha_donation SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfid = %d,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdonation_amount='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfirstname='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlastname='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\temail='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmycharityfees='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttotal_donation='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tinsert_date='%s',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstatus='%s'\n\t\t\t", $fid, $donation_amount, $firstname, $lastname, $email, $message, $mycharityfees, $donation_amount, $insert_date, $status);
$Query = $MSObj->Query($query);
$id = mysql_insert_id();
/*##################################################################################################