當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DbConnect::connection方法代碼示例

本文整理匯總了PHP中DbConnect::connection方法的典型用法代碼示例。如果您正苦於以下問題:PHP DbConnect::connection方法的具體用法?PHP DbConnect::connection怎麽用?PHP DbConnect::connection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DbConnect的用法示例。


在下文中一共展示了DbConnect::connection方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: session_start

<?php

session_start();
header("content-type:text/html;charset=utf-8");
require_once './function/DbConnect.php';
$openid = $_SESSION['openid'];
if (!isset($openid)) {
    exit;
}
if (($_POST['name'] == null or $_POST['number']) == null or $_POST['telephone'] == null) {
    echo "對不起,信息不全,請重新填寫";
    sleep(3);
    echo "<script language=\"javascript\">";
    echo "history.go(-1)";
    echo "</script>";
} else {
    $con = DbConnect::connection();
    DbConnect::insertByUsername($openid, $_POST['name'], $_POST['sex'], $_POST['apartment'], $_POST['number'], $_POST['telephone'], $con);
    $url = "order.php";
    echo "<script language=\"javascript\">";
    echo "location.href=\"{$url}\"";
    echo "</script>";
}
開發者ID:SebastianElvis,項目名稱:mtcds,代碼行數:23,代碼來源:insert.php

示例2: modifyPrice

 public static function modifyPrice()
 {
     echo "<form action=\"manager.php?action=modifyPrice\" method=\"post\"><select name=\"rest\">";
     $con = DbConnect::connection();
     mysql_select_db("app_mtcds", $con);
     $result = mysql_query("select * from restaurant");
     while ($row = mysql_fetch_array($result)) {
         echo "<option value=" . $row['restid'] . "> " . $row['name'] . "</option>";
     }
     echo "</select>";
     echo "<select name=\"type\">";
     $result = mysql_query("select * from type");
     while ($row = mysql_fetch_array($result)) {
         echo "<option value=" . $row['id'] . "> " . $row['name'] . "</option>";
     }
     echo "</select>";
     echo "<input type='text' name='number'>";
     echo "<input type='submit' value='提交'>";
     echo "</form>";
 }
開發者ID:SebastianElvis,項目名稱:mtcds,代碼行數:20,代碼來源:DbConnect.php


注:本文中的DbConnect::connection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。